diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 397d40a..e33d957 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -20,5 +20,4 @@ jobs: with: node-version: ${{ matrix.node-version }} - run: npm install - - run: echo ::set-env name=VERSION::$(npx -c 'echo "$npm_package_version"') - - run: npx vsce publish $VERSION -p ${{ secrets.VSCE_TOKEN}} + - run: npx vsce publish -p ${{ secrets.VSCE_TOKEN}} diff --git a/.gitignore b/.gitignore index 2588b3b..e3ceaf6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ node_modules .vscode-test/ *.vsix -test/user/ +out/test/user/ diff --git a/CHANGELOG.md b/CHANGELOG.md index 76ca18b..5e8c98d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,34 @@ +## 1.1.0 (2020-09-05) + +### Added +- [#28](https://github.com/kotfire/vscode-php-add-property/issues/28) Add support for nullable property types + +### Fixed +- [#26](https://github.com/kotfire/vscode-php-add-property/issues/26) Do not add extra space using docblock with param + +## 1.0.0 (2020-08-31) + +### Added +- Rewrite to use a PHP parser to reduce usage of RegExp +- Rewrite to use typescript +- Add a new command to remove properties +- Add a new command to rename properties +- Add a new command to change properties type +- Add a new command to transform a constructor into multiline +- Allow to configure the context menu commands via settings + +### Fixed +- [#22](https://github.com/kotfire/vscode-php-add-property/issues/22) Add existing properties does not work with typed properties +- [#23](https://github.com/kotfire/vscode-php-add-property/issues/23) Decrease the minimum vscode version to 1.31.0 + +## 0.5.0 (2020-02-07) + +### Added +- Support to insert properties in different classes on the same file + +### Fixed +- The file indentation was not respected sometimes + ## 0.4.1 (2020-02-06) ### Fixed diff --git a/FUNDING.yml b/FUNDING.yml new file mode 100644 index 0000000..707be5d --- /dev/null +++ b/FUNDING.yml @@ -0,0 +1,3 @@ +github: kotfire +ko_fi: kotfire +custom: ["https://plant.treeware.earth/kotfire/vscode-php-add-property"] diff --git a/README.md b/README.md index 654f2ba..90103d6 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,16 @@ -[![Version](https://vsmarketplacebadge.apphb.com/version-short/kotfire.php-add-property.svg)](https://marketplace.visualstudio.com/items?itemName=kotfire.php-add-property) -[![Rating](https://vsmarketplacebadge.apphb.com/rating-short/kotfire.php-add-property.svg)](https://marketplace.visualstudio.com/items?itemName=kotfire.php-add-property) -[![Installs](https://vsmarketplacebadge.apphb.com/installs/kotfire.php-add-property.svg)](https://marketplace.visualstudio.com/items?itemName=kotfire.php-add-property) +[![Version](https://vsmarketplacebadge.apphb.com/version-short/kotfire.php-add-property.svg?style=for-the-badge)](https://marketplace.visualstudio.com/items?itemName=kotfire.php-add-property) +[![Rating](https://vsmarketplacebadge.apphb.com/rating-short/kotfire.php-add-property.svg?style=for-the-badge)](https://marketplace.visualstudio.com/items?itemName=kotfire.php-add-property) +[![Installs](https://vsmarketplacebadge.apphb.com/installs/kotfire.php-add-property.svg?style=for-the-badge)](https://marketplace.visualstudio.com/items?itemName=kotfire.php-add-property) # PHP Add Property -Visual Code Studio extension to quickly add PHP class properties +Visual Code Studio extension to manage PHP class properties + +## Support my work + +[![Github sponsors](https://img.shields.io/badge/Sponsor%20now-181717?style=for-the-badge&logo=github)](https://github.com/sponsors/kotfire) +[![Buy me a tea](https://img.shields.io/badge/Buy%20me%20a%20tea-555555?style=for-the-badge&logo=Ko-fi)](https://ko-fi.com/M4M71TVH1) +[![Buy the world a tree](https://img.shields.io/badge/Buy%20the%20world%20a%20tree-%F0%9F%8C%B3-242424?labelColor=276749&style=for-the-badge)](https://plant.treeware.earth/kotfire/vscode-php-add-property) ## Features @@ -18,6 +24,18 @@ Visual Code Studio extension to quickly add PHP class properties ![Add existing properties demo](images/existing.gif) +### Remove a property + +![Remove a property demo](images/remove.gif) + +### Rename a property + +![Remove a property demo](images/rename.gif) + +### Change property type + +![Remove a property demo](images/type.gif) + ### Insert constructor Automatically insert a constructor if it does not exist. @@ -53,4 +71,11 @@ This extension contributes the following settings: * `phpAddProperty.constructor.breakIntoMultilineIfLengthExceeded.enabled`: Specifies whether to break the constructor into multiple lines if the given line length is exceeded * `phpAddProperty.constructor.breakIntoMultilineIfLengthExceeded.maxLineLength`: Specifies the maximum line length before using a multiline constructor * `phpAddProperty.showMessagesOnStatusBar`: Specifies whether to show messages on status bar instead of notification box -* `phpAddProperty.showContextMenuOptions`: Specifies whether to show the context menu options +* `phpAddProperty.contextMenuOptions.enable`: Specifies whether to show the context menu options +* `phpAddProperty.contextMenuOptions.addProperty`: Specifies whether to show the add property command in the context menu options +* `phpAddProperty.contextMenuOptions.appendProperty`: Specifies whether to show the append property command in the context menu options +* `phpAddProperty.contextMenuOptions.renameProperty`: Specifies whether to show the rename property command in the context menu options +* `phpAddProperty.contextMenuOptions.changePropertyType`: Specifies whether to show the change property type command in the context menu options +* `phpAddProperty.contextMenuOptions.removeProperty`: Specifies whether to show the remove property command in the context menu options +* `phpAddProperty.contextMenuOptions.breakConstructorIntoMultiline`: Specifies whether to show the break constructor into multiline command in the context menu options +* `phpAddProperty.showVersionUpdates`: Specifies whether to show What's New after upgrading to a new version diff --git a/images/add.gif b/images/add.gif index 8e9a3ae..5199b53 100644 Binary files a/images/add.gif and b/images/add.gif differ diff --git a/images/constructor.gif b/images/constructor.gif index 50ccde6..610e0c7 100644 Binary files a/images/constructor.gif and b/images/constructor.gif differ diff --git a/images/customizable.gif b/images/customizable.gif index 36494a4..8176c58 100644 Binary files a/images/customizable.gif and b/images/customizable.gif differ diff --git a/images/existing.gif b/images/existing.gif index 81466c8..4ae221a 100644 Binary files a/images/existing.gif and b/images/existing.gif differ diff --git a/images/multiline.gif b/images/multiline.gif index cb6add3..62aebde 100644 Binary files a/images/multiline.gif and b/images/multiline.gif differ diff --git a/images/remove.gif b/images/remove.gif new file mode 100644 index 0000000..75f8460 Binary files /dev/null and b/images/remove.gif differ diff --git a/images/rename.gif b/images/rename.gif new file mode 100644 index 0000000..b47a124 Binary files /dev/null and b/images/rename.gif differ diff --git a/images/type.gif b/images/type.gif new file mode 100644 index 0000000..930ad7f Binary files /dev/null and b/images/type.gif differ diff --git a/jsconfig.json b/jsconfig.json deleted file mode 100644 index e01e188..0000000 --- a/jsconfig.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "checkJs": false, /* Typecheck .js files. */ - "lib": [ - "es6" - ] - }, - "exclude": [ - "node_modules" - ] -} diff --git a/out/addPropertyStatement.js b/out/addPropertyStatement.js new file mode 100644 index 0000000..83cb224 --- /dev/null +++ b/out/addPropertyStatement.js @@ -0,0 +1,63 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const vscode = require("vscode"); +const utils_1 = require("./utils"); +function addPropertyStatement(document, phpClass, property, tabStops) { + var _a; + const phpClassRange = new vscode.Range(new vscode.Position(phpClass.ast.loc.start.line - 1, phpClass.ast.loc.start.column), new vscode.Position(phpClass.ast.loc.end.line - 1, phpClass.ast.loc.end.column)); + let newDocumentText = utils_1.escapeForSnippet(document.getText(phpClassRange)); + let lastProperty; + let firstMethod; + let lastNode; + const astClassBody = phpClass.ast.body; + for (let i = 0; i < astClassBody.length; i++) { + const node = astClassBody[i]; + lastNode = node; + if (node.kind === 'propertystatement') { + lastProperty = node; + // Check that property does not already exist + for (let j = 0; j < node.properties.length; j++) { + const propertyNode = node.properties[j]; + if (((_a = propertyNode.name) === null || _a === void 0 ? void 0 : _a.name) === property.getName()) { + return newDocumentText; + } + } + } + else if (!firstMethod && node.kind === 'method' && node.name !== '__construct') { + firstMethod = node; + } + } + const propertyStatementText = property.getStatementText(tabStops); + if (lastProperty) { + const lastPropertyLine = document.lineAt(lastProperty.loc.start.line - 1); + const newPropertyText = utils_1.escapeForSnippet(`${lastPropertyLine.text}`) + "\n\n" + utils_1.indentText(propertyStatementText, utils_1.calculateIndentationLevel(utils_1.getLineFirstNonIndentationCharacterIndex(lastPropertyLine.text))); + newDocumentText = newDocumentText.replace(utils_1.escapeForSnippet(lastPropertyLine.text), newPropertyText); + } + else if (firstMethod) { + const firstMethodLine = document.lineAt(firstMethod.loc.start.line - 1); + const newPropertyText = utils_1.indentText(propertyStatementText, utils_1.calculateIndentationLevel(utils_1.getLineFirstNonIndentationCharacterIndex(firstMethodLine.text))) + "\n\n" + utils_1.escapeForSnippet(firstMethodLine.text); + newDocumentText = newDocumentText.replace(utils_1.escapeForSnippet(firstMethodLine.text), newPropertyText); + } + else if (lastNode) { + const lastNodeLine = document.lineAt(lastNode.loc.start.line - 1); + const newPropertyText = utils_1.escapeForSnippet(lastNodeLine.text) + "\n\n" + utils_1.indentText(propertyStatementText, utils_1.calculateIndentationLevel(utils_1.getLineFirstNonIndentationCharacterIndex(lastNodeLine.text))); + newDocumentText = newDocumentText.replace(utils_1.escapeForSnippet(lastNodeLine.text), newPropertyText); + } + else { + const isOneLineClass = phpClass.ast.loc.start.line === phpClass.ast.loc.end.line; + if (isOneLineClass) { + const match = phpClass.ast.loc.source.match(/(.*)\}/); + const newPropertyText = utils_1.escapeForSnippet(match[1]) + "\n" + utils_1.indentText(propertyStatementText, 1) + "\n" + '}'; + newDocumentText = newDocumentText.replace(utils_1.escapeForSnippet(phpClass.ast.loc.source), newPropertyText); + } + else { + const classBodyLine = document.lineAt(phpClass.ast.loc.start.line - 1); + const classText = utils_1.escapeForSnippet(phpClass.ast.loc.source); + const newPropertyText = classText.replace(/{(?:\s|[\r\n]|\s)*}/, "{\n" + utils_1.indentText(propertyStatementText, utils_1.calculateIndentationLevel(utils_1.getLineFirstNonIndentationCharacterIndex(classBodyLine.text)) + 1)) + "\n}"; + newDocumentText = newDocumentText.replace(classText, newPropertyText); + } + } + return newDocumentText; +} +exports.default = addPropertyStatement; +//# sourceMappingURL=addPropertyStatement.js.map \ No newline at end of file diff --git a/out/addPropertyStatement.js.map b/out/addPropertyStatement.js.map new file mode 100644 index 0000000..4024a71 --- /dev/null +++ b/out/addPropertyStatement.js.map @@ -0,0 +1 @@ +{"version":3,"file":"addPropertyStatement.js","sourceRoot":"","sources":["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MAAM,eAAe,GAAG,SAAS,CAAC,OAAO,CAAC,qBAAqB,EAAE,KAAK,GAAG,kBAAU,CAClF,qBAAqB,EACrB,iCAAyB,CACxB,gDAAwC,CAAC,aAAa,CAAC,IAAI,CAAC,CAC5D,GAAG,CAAC,CACL,CAAC,GAAG,KAAK,CAAC;YAEX,eAAe,GAAG,eAAe,CAAC,OAAO,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;SACtE;KACD;IAED,OAAO,eAAe,CAAC;AACxB,CAAC;AAjGD,uCAiGC"} \ No newline at end of file diff --git a/out/changePropertyType.js b/out/changePropertyType.js new file mode 100644 index 0000000..7155860 --- /dev/null +++ b/out/changePropertyType.js @@ -0,0 +1,75 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const vscode = require("vscode"); +const utils_1 = require("./utils"); +function changePropertyType(editor, property, newPropertyType, phpClass) { + var _a, _b, _c, _d, _e; + const document = editor.document; + const phpClassRange = new vscode.Range(new vscode.Position(phpClass.ast.loc.start.line - 1, phpClass.ast.loc.start.column), new vscode.Position(phpClass.ast.loc.end.line - 1, phpClass.ast.loc.end.column)); + let newDocumentText = document.getText(phpClassRange); + const astClassBody = phpClass.ast.body; + for (let i = 0; i < astClassBody.length; i++) { + const node = astClassBody[i]; + if (node.kind === 'propertystatement') { + let newPropertyStatementText; + for (let j = 0; j < node.properties.length; j++) { + const propertyNode = node.properties[j]; + if (((_a = propertyNode.name) === null || _a === void 0 ? void 0 : _a.name) == property.getName()) { + const propertyStatementRange = new vscode.Range(new vscode.Position(node.loc.start.line - 1, 0), new vscode.Position(node.loc.end.line, 0)); + const propertyStatementText = document.getText(propertyStatementRange); + let newPropertyText = `\$${property.getName()}`; + if (utils_1.config('phpAddProperty.property.types') === true || propertyNode.type) { + newPropertyText = `${newPropertyType} ${newPropertyText}`; + } + newPropertyStatementText = propertyStatementText.replace(propertyNode.loc.source, newPropertyText); + newDocumentText = newDocumentText.replace(propertyStatementText, newPropertyStatementText); + } + } + if (newPropertyStatementText) { + for (let i = 0; i < ((_b = node.leadingComments) === null || _b === void 0 ? void 0 : _b.length); i++) { + const commentNode = node.leadingComments[i]; + const commentRange = new vscode.Range(new vscode.Position(commentNode.loc.start.line - 1, 0), new vscode.Position(commentNode.loc.end.line, 0)); + const commentText = document.getText(commentRange); + const typeMatch = /@var\s(\S*)/g.exec(commentText); + if (typeMatch) { + const newCommentText = commentText.replace(typeMatch[1], newPropertyType); + const regexp = new RegExp(`${utils_1.escapeForRegExp(commentText)}((?:\s|[\r\n])*)${utils_1.escapeForRegExp(newPropertyStatementText)}`); + newDocumentText = newDocumentText.replace(regexp, `${newCommentText}$1${newPropertyStatementText}`); + } + } + break; + } + } + } + const constructor = phpClass.getConstructor(); + if (constructor) { + for (let i = 0; i < constructor.ast.arguments.length; i++) { + const node = constructor.ast.arguments[i]; + if (((_c = node.name) === null || _c === void 0 ? void 0 : _c.name) == property.getName()) { + const constructorText = constructor.ast.loc.source; + const newConstructorText = constructorText.replace(node.loc.source, `${newPropertyType} \$${property.getName()}`); + newDocumentText = newDocumentText.replace(constructorText, newConstructorText); + break; + } + } + for (let i = 0; i < ((_d = constructor.ast.leadingComments) === null || _d === void 0 ? void 0 : _d.length); i++) { + const commentNode = constructor.ast.leadingComments[i]; + const commentRange = new vscode.Range(new vscode.Position(commentNode.loc.start.line - 1, 0), new vscode.Position(commentNode.loc.end.line, 0)); + const commentText = document.getText(commentRange); + const regexp = new RegExp(`\\S*(\\s+\\$${property.getName()})`); + const newCommentText = commentText.replace(regexp, `${newPropertyType}$1`); + newDocumentText = newDocumentText.replace(commentText, newCommentText); + } + } + if (newDocumentText === document.getText(phpClassRange)) { + return; + } + (_e = vscode.window.activeTextEditor) === null || _e === void 0 ? void 0 : _e.edit(editBuilder => { + editBuilder.replace(phpClassRange, newDocumentText); + }, { + undoStopBefore: true, + undoStopAfter: false + }); +} +exports.changePropertyType = changePropertyType; +//# sourceMappingURL=changePropertyType.js.map \ No newline at end of file diff --git a/out/changePropertyType.js.map b/out/changePropertyType.js.map new file mode 100644 index 0000000..c9deb1f --- /dev/null +++ b/out/changePropertyType.js.map @@ -0,0 +1 @@ +{"version":3,"file":"changePropertyType.js","sourceRoot":"","sources":["../src/changePropertyType.ts"],"names":[],"mappings":";;AAAA,iCAAiC;AAGjC,mCAAkD;AAElD,SAAgB,kBAAkB,CAAC,MAAyB,EAAE,QAAkB,EAAE,eAAuB,EAAE,QAAe;;IACzH,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;IACjC,MAAM,aAAa,GAAG,IAAI,MAAM,CAAC,KAAK,CACrC,IAAI,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,EAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,EACnF,IAAI,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,EAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAC/E,CAAC;IAEF,IAAI,eAAe,GAAG,QAAQ,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IAEnD,MAAM,YAAY,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC;IAC1C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAC7C,MAAM,IAAI,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;QAE7B,IAAI,IAAI,CAAC,IAAI,KAAK,mBAAmB,EAAE;YAC7B,IAAI,wBAAwB,CAAC;YAEtC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBACpC,MAAM,YAAY,GAAG,IAAI,CAA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DA2HC"} \ No newline at end of file diff --git a/out/class.js b/out/class.js new file mode 100644 index 0000000..fc91385 --- /dev/null +++ b/out/class.js @@ -0,0 +1,23 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const constructor_1 = require("./constructor"); +class Class { + constructor(ast) { + this.ast = ast; + this.findConstructor(); + } + getConstructor() { + return this.construct; + } + findConstructor() { + var _a; + for (let i = 0; i < this.ast.body.length; i++) { + const node = this.ast.body[i]; + if (node.kind === 'method' && ((_a = node.name) === null || _a === void 0 ? void 0 : _a.name) === '__construct') { + this.construct = new constructor_1.default(node); + } + } + } +} +exports.default = Class; +//# sourceMappingURL=class.js.map \ No newline at end of file diff --git a/out/class.js.map b/out/class.js.map new file mode 100644 index 0000000..8bd8b86 --- /dev/null +++ b/out/class.js.map @@ -0,0 +1 @@ +{"version":3,"file":"class.js","sourceRoot":"","sources":["../src/class.ts"],"names":[],"mappings":";;AAAA,+CAAwC;AAExC,MAAqB,KAAK;IAKtB,YAAY,GAAQ;QAChB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QAEf,IAAI,CAAC,eAAe,EAAE,CAAC;IAC3B,CAAC;IAEM,cAAc;QACjB,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IAEO,eAAe;;QACnB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC3C,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAE9B,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,IAAI,OAAA,IAAI,CAAC,IAAI,0CAAE,IAAI,MAAK,aAAa,EAAE;gBAC7D,IAAI,CAAC,SAAS,GAAG,IAAI,qBAAW,CAAC,IAAI,CAAC,CAAC;aAC1C;SACJ;IACL,CAAC;CACJ;AAxBD,wBAwBC"} \ No newline at end of file diff --git a/out/constants.js b/out/constants.js new file mode 100644 index 0000000..413a0c9 --- /dev/null +++ b/out/constants.js @@ -0,0 +1,10 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.extensionId = 'php-add-property'; +exports.extensionQualifiedId = `kotfire.${exports.extensionId}`; +exports.debugEnvName = 'PHP_ADD_PROPERTY_DEBUG_MODE'; +var GlobalState; +(function (GlobalState) { + GlobalState["version"] = "phpAddPropertyVersion"; +})(GlobalState = exports.GlobalState || (exports.GlobalState = {})); +//# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/out/constants.js.map b/out/constants.js.map new file mode 100644 index 0000000..ad7e4f4 --- /dev/null +++ b/out/constants.js.map @@ -0,0 +1 @@ +{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;AAAa,QAAA,WAAW,GAAG,kBAAkB,CAAC;AACjC,QAAA,oBAAoB,GAAG,WAAW,mBAAW,EAAE,CAAC;AAChD,QAAA,YAAY,GAAG,6BAA6B,CAAC;AAE1D,IAAY,WAEX;AAFD,WAAY,WAAW;IACtB,gDAAiC,CAAA;AAClC,CAAC,EAFW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAEtB"} \ No newline at end of file diff --git a/out/constructor.js b/out/constructor.js new file mode 100644 index 0000000..c6547a7 --- /dev/null +++ b/out/constructor.js @@ -0,0 +1,9 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +class Constructor { + constructor(ast) { + this.ast = ast; + } +} +exports.default = Constructor; +//# sourceMappingURL=constructor.js.map \ No newline at end of file diff --git a/out/constructor.js.map b/out/constructor.js.map new file mode 100644 index 0000000..abded34 --- /dev/null +++ b/out/constructor.js.map @@ -0,0 +1 @@ +{"version":3,"file":"constructor.js","sourceRoot":"","sources":["../src/constructor.ts"],"names":[],"mappings":";;AAAA,MAAqB,WAAW;IAG5B,YAAY,GAAQ;QAChB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACnB,CAAC;CACJ;AAND,8BAMC"} \ No newline at end of file diff --git a/out/extension.js b/out/extension.js new file mode 100644 index 0000000..1ad1368 --- /dev/null +++ b/out/extension.js @@ -0,0 +1,358 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const vscode = require("vscode"); +const php_parser_1 = require("php-parser"); +const locator_1 = require("./locator"); +const property_1 = require("./property"); +const insertProperty_1 = require("./insertProperty"); +const removeProperty_1 = require("./removeProperty"); +const utils_1 = require("./utils"); +const renameProperty_1 = require("./renameProperty"); +const changePropertyType_1 = require("./changePropertyType"); +const constants_1 = require("./constants"); +function activate(context) { + return __awaiter(this, void 0, void 0, function* () { + const extension = vscode.extensions.getExtension(constants_1.extensionQualifiedId); + const version = extension.packageJSON.version; + const previousVersion = context.globalState.get(constants_1.GlobalState.version); + const versionAsInt = parseInt(version.replace(/\./g, '')); + const previousVersionAsInt = previousVersion ? parseInt(previousVersion.replace(/\./g, '')) : 0; + const showUpdatesEnabled = utils_1.config('phpAddProperty.showVersionUpdates') === true; + if (utils_1.isDebugMode() || (showUpdatesEnabled && previousVersionAsInt < versionAsInt)) { + try { + const extensionRoot = context.asAbsolutePath(`webviews/${version}`); + const filename = `${extensionRoot}/index.html`; + const doc = yield vscode.workspace.openTextDocument(filename); + const content = doc.getText(); + const html = content.replace(/#{root}/g, vscode.Uri.file(extensionRoot) + .with({ scheme: 'vscode-resource' }) + .toString()); + const panel = vscode.window.createWebviewPanel(`phpAddPropertyWebView-${version}`, `PHP Add Property: What's new in v${version}`, vscode.ViewColumn.One, { + localResourceRoots: [vscode.Uri.file(context.extensionPath)], + }); + panel.iconPath = vscode.Uri.file(context.asAbsolutePath('images/icon.png')); + panel.webview.html = html; + } + catch (error) { + if (utils_1.isDebugMode()) { + console.error(error); + } + } + } + context.globalState.update(constants_1.GlobalState.version, version); + context.subscriptions.push(vscode.commands.registerCommand('phpAddProperty.add', () => __awaiter(this, void 0, void 0, function* () { + if (vscode.window.activeTextEditor === undefined) { + return; + } + const document = vscode.window.activeTextEditor.document; + const phpEngine = new php_parser_1.default({ + ast: { + withPositions: false, + withSource: true, + }, + lexer: { + debug: false, + all_tokens: true, + comment_tokens: true, + mode_eval: false, + asp_tags: false, + short_tags: true, + }, + parser: { + debug: false, + extractDoc: true, + suppressErrors: true + }, + }); + const ast = phpEngine.parseCode(document.getText()); + const locator = new locator_1.default(ast); + const selectionLineNumber = vscode.window.activeTextEditor.selection.active.line; + const phpClass = locator.findClass(selectionLineNumber + 1); + if (!phpClass) { + vscode.window.showInformationMessage('No class found'); + return; + } + const name = yield vscode.window.showInputBox({ + placeHolder: 'Enter the property name' + }); + if (name === undefined || name.trim() === "") { + return; + } + const property = new property_1.default(name); + insertProperty_1.default(vscode.window.activeTextEditor, property, phpClass, `${property.getName()};`); + })), vscode.commands.registerCommand('phpAddProperty.append', () => __awaiter(this, void 0, void 0, function* () { + var _a, _b, _c, _d, _e, _f, _g; + if (vscode.window.activeTextEditor === undefined) { + return; + } + const document = vscode.window.activeTextEditor.document; + const phpEngine = new php_parser_1.default({ + ast: { + withPositions: false, + withSource: true, + }, + lexer: { + debug: false, + all_tokens: true, + comment_tokens: true, + mode_eval: false, + asp_tags: false, + short_tags: true, + }, + parser: { + debug: false, + extractDoc: true, + suppressErrors: true + }, + }); + const ast = phpEngine.parseCode(document.getText()); + const locator = new locator_1.default(ast); + const selectionLineNumber = vscode.window.activeTextEditor.selection.active.line; + const phpClass = locator.findClass(selectionLineNumber + 1); + if (!phpClass) { + vscode.window.showInformationMessage('No class found'); + return; + } + const line = document.lineAt(selectionLineNumber); + const lineAst = phpEngine.parseEval(`class A { ${line.text} }`); + if (((_b = (_a = lineAst.children[0]) === null || _a === void 0 ? void 0 : _a.body[0]) === null || _b === void 0 ? void 0 : _b.kind) !== 'propertystatement') { + return; + } + const selectedWord = document.getText(document.getWordRangeAtPosition(vscode.window.activeTextEditor.selection.active)).replace(/^\$/, ''); + const properties = lineAst.children[0].body[0].properties; + const propertyAst = (_c = properties.find((propertyAst) => { var _a; return ((_a = propertyAst.name) === null || _a === void 0 ? void 0 : _a.name) === selectedWord; })) !== null && _c !== void 0 ? _c : properties[0]; + const propertyName = (_d = propertyAst.name) === null || _d === void 0 ? void 0 : _d.name; + const propertyStatementAst = phpClass.ast.body.find((node) => { + if (node.kind !== 'propertystatement') { + return false; + } + return node.properties.find((propertyAst) => { var _a; return ((_a = propertyAst.name) === null || _a === void 0 ? void 0 : _a.name) === propertyName; }); + }); + if (!propertyStatementAst) { + return; + } + let docblockType; + for (let i = 0; i < ((_e = propertyStatementAst.leadingComments) === null || _e === void 0 ? void 0 : _e.length); i++) { + const node = propertyStatementAst.leadingComments[i]; + if (node.kind !== 'commentblock') { + continue; + } + const typeMatch = /@var\s(\S*)/g.exec(node.value); + if (typeMatch) { + docblockType = typeMatch[1]; + let types = docblockType.split('|').map(type => type.trim()); + const nullableTypeIndex = types.indexOf('null'); + if (nullableTypeIndex !== -1) { + types.splice(nullableTypeIndex, 1); + docblockType = `?${types.join('|')}`; + } + } + } + const property = new property_1.default(propertyName, propertyAst.nullable, (_g = (_f = propertyAst.type) === null || _f === void 0 ? void 0 : _f.name) !== null && _g !== void 0 ? _g : docblockType); + insertProperty_1.default(vscode.window.activeTextEditor, property, phpClass, line.text); + })), vscode.commands.registerCommand('phpAddProperty.rename', () => __awaiter(this, void 0, void 0, function* () { + if (vscode.window.activeTextEditor === undefined) { + return; + } + const document = vscode.window.activeTextEditor.document; + const phpEngine = new php_parser_1.default({ + ast: { + withPositions: false, + withSource: true, + }, + lexer: { + debug: false, + all_tokens: true, + comment_tokens: true, + mode_eval: false, + asp_tags: false, + short_tags: true, + }, + parser: { + debug: false, + extractDoc: true, + suppressErrors: true + }, + }); + const ast = phpEngine.parseCode(document.getText()); + const locator = new locator_1.default(ast); + const selectionLineNumber = vscode.window.activeTextEditor.selection.active.line; + const phpClass = locator.findClass(selectionLineNumber); + if (!phpClass) { + vscode.window.showInformationMessage('No class found'); + return; + } + const line = document.lineAt(selectionLineNumber); + let propertyName = utils_1.getPropertyNameFromLineText(line.text, document, phpEngine, vscode.window.activeTextEditor.selection.active); + if (!propertyName) { + propertyName = yield vscode.window.showInputBox({ + placeHolder: 'Enter the property name you want to rename' + }); + } + if (propertyName === undefined || propertyName.trim() === "") { + return; + } + const property = new property_1.default(propertyName); + const newPropertyName = yield vscode.window.showInputBox({ + placeHolder: 'Enter the new property name' + }); + if (newPropertyName === undefined || newPropertyName.trim() === "") { + return; + } + const newProperty = new property_1.default(newPropertyName); + renameProperty_1.renameProperty(vscode.window.activeTextEditor, property, newProperty, phpClass); + })), vscode.commands.registerCommand('phpAddProperty.changeType', () => __awaiter(this, void 0, void 0, function* () { + if (vscode.window.activeTextEditor === undefined) { + return; + } + const document = vscode.window.activeTextEditor.document; + const phpEngine = new php_parser_1.default({ + ast: { + withPositions: false, + withSource: true, + }, + lexer: { + debug: false, + all_tokens: true, + comment_tokens: true, + mode_eval: false, + asp_tags: false, + short_tags: true, + }, + parser: { + debug: false, + extractDoc: true, + suppressErrors: true + }, + }); + const ast = phpEngine.parseCode(document.getText()); + const locator = new locator_1.default(ast); + const selectionLineNumber = vscode.window.activeTextEditor.selection.active.line; + const phpClass = locator.findClass(selectionLineNumber); + if (!phpClass) { + vscode.window.showInformationMessage('No class found'); + return; + } + const line = document.lineAt(selectionLineNumber); + let propertyName = utils_1.getPropertyNameFromLineText(line.text, document, phpEngine, vscode.window.activeTextEditor.selection.active); + if (!propertyName) { + propertyName = yield vscode.window.showInputBox({ + placeHolder: 'Enter the property name you want to change type' + }); + } + if (propertyName === undefined || propertyName.trim() === "") { + return; + } + const property = new property_1.default(propertyName); + const newPropertyType = yield vscode.window.showInputBox({ + placeHolder: 'Enter the new property type' + }); + if (newPropertyType === undefined || newPropertyType.trim() === "") { + return; + } + changePropertyType_1.changePropertyType(vscode.window.activeTextEditor, property, newPropertyType, phpClass); + })), vscode.commands.registerCommand('phpAddProperty.remove', () => __awaiter(this, void 0, void 0, function* () { + if (vscode.window.activeTextEditor === undefined) { + return; + } + const document = vscode.window.activeTextEditor.document; + const phpEngine = new php_parser_1.default({ + ast: { + withPositions: false, + withSource: true, + }, + lexer: { + debug: false, + all_tokens: true, + comment_tokens: true, + mode_eval: false, + asp_tags: false, + short_tags: true, + }, + parser: { + debug: false, + extractDoc: true, + suppressErrors: true + }, + }); + const ast = phpEngine.parseCode(document.getText()); + const locator = new locator_1.default(ast); + const selectionLineNumber = vscode.window.activeTextEditor.selection.active.line; + const phpClass = locator.findClass(selectionLineNumber); + if (!phpClass) { + vscode.window.showInformationMessage('No class found'); + return; + } + const line = document.lineAt(selectionLineNumber); + let propertyName = utils_1.getPropertyNameFromLineText(line.text, document, phpEngine, vscode.window.activeTextEditor.selection.active); + if (!propertyName) { + propertyName = yield vscode.window.showInputBox({ + placeHolder: 'Enter the property name you want to remove' + }); + } + if (propertyName === undefined || propertyName.trim() === "") { + return; + } + const property = new property_1.default(propertyName); + removeProperty_1.removeProperty(vscode.window.activeTextEditor, property, phpClass); + })), vscode.commands.registerCommand('phpAddProperty.breakConstructorIntoMultiline', () => __awaiter(this, void 0, void 0, function* () { + var _h; + if (vscode.window.activeTextEditor === undefined) { + return; + } + const document = vscode.window.activeTextEditor.document; + const phpEngine = new php_parser_1.default({ + ast: { + withPositions: false, + withSource: true, + }, + lexer: { + debug: false, + all_tokens: true, + comment_tokens: true, + mode_eval: false, + asp_tags: false, + short_tags: true, + }, + parser: { + debug: false, + extractDoc: true, + suppressErrors: true + }, + }); + const ast = phpEngine.parseCode(document.getText()); + const locator = new locator_1.default(ast); + const selectionLineNumber = vscode.window.activeTextEditor.selection.active.line; + const phpClass = locator.findClass(selectionLineNumber + 1); + if (!phpClass) { + vscode.window.showInformationMessage('No class found'); + return; + } + const phpClassRange = new vscode.Range(new vscode.Position(phpClass.ast.loc.start.line - 1, phpClass.ast.loc.start.column), new vscode.Position(phpClass.ast.loc.end.line - 1, phpClass.ast.loc.end.column)); + const newDocumentText = utils_1.forceBreakConstructorIntoMultiline(document.getText(phpClassRange)); + if (newDocumentText === document.getText(phpClassRange)) { + return; + } + (_h = vscode.window.activeTextEditor) === null || _h === void 0 ? void 0 : _h.edit(editBuilder => { + editBuilder.replace(phpClassRange, newDocumentText); + }, { + undoStopBefore: true, + undoStopAfter: false + }); + }))); + }); +} +exports.activate = activate; +// this method is called when your extension is deactivated +function deactivate() { } +exports.deactivate = deactivate; +//# sourceMappingURL=extension.js.map \ No newline at end of file diff --git a/out/extension.js.map b/out/extension.js.map new file mode 100644 index 0000000..a4da07b --- /dev/null +++ b/out/extension.js.map @@ -0,0 +1 @@ +{"version":3,"file":"extension.js","sourceRoot":"","sources":["../src/extension.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,iCAAiC;AACjC,2CAAmC;AACnC,uCAAgC;AAChC,yCAAkC;AAClC,qDAA8C;AAC9C,qDAAkD;AAClD,mCAA+G;AAC/G,qDAAkD;AAClD,6DAA0D;AAC1D,2CAAgE;AAEhE,SAAsB,QAAQ,CAAC,OAAgC;;QAC9D,MAAM,SAAS,GAAG,MAAM,CAAC,UAAU,CAAC,YAAY,CAAC,gCAAoB,CAAE,CAAC;QACxE,MAAM,OAAO,GAAG,SAAS,CAAC,WAAW,CAAC,OAAO,CAAC;QAC9C,MAAM,eAAe,GAAG,OAAO,CAAC,WAAW,CAAC,GAAG,CAAS,uBAAW,CAAC,OAAO,CAAC,CAAC;QAE7E,MAAM,YAAY,GAAG,QAAQ,CAAE,OAAkB,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,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AC,GAAG,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,EAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAC/E,CAAC;YAEF,MAAM,eAAe,GAAG,0CAAkC,CAAC,QAAQ,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC;YAE5F,IAAI,eAAe,KAAK,QAAQ,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE;gBACxD,OAAO;aACP;YAED,MAAA,MAAM,CAAC,MAAM,CAAC,gBAAgB,0CAAE,IAAI,CACnC,WAAW,CAAC,EAAE;gBACb,WAAW,CAAC,OAAO,CAAC,aAAa,EAAE,eAAe,CAAC,CAAC;YACrD,CAAC,EACD;gBACC,cAAc,EAAE,IAAI;gBACpB,aAAa,EAAE,KAAK;aACpB,EACA;QACH,CAAC,CAAA,CAAC,CACF,CAAC;IACH,CAAC;CAAA;AApdD,4BAodC;AAED,2DAA2D;AAC3D,SAAgB,UAAU,KAAK,CAAC;AAAhC,gCAAgC"} \ No newline at end of file diff --git a/out/factory.js b/out/factory.js new file mode 100644 index 0000000..9d1907d --- /dev/null +++ b/out/factory.js @@ -0,0 +1,17 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const php_parser_1 = require("php-parser"); +function createProperty(name, value) { + let statement = `\$${name}`; + if (value) { + statement += ` = ${value}`; + } + const ast = php_parser_1.default.parseEval(` + class a { + ${statement}; + } + `); + return ast.children[0].body[0]; +} +exports.createProperty = createProperty; +//# sourceMappingURL=factory.js.map \ No newline at end of file diff --git a/out/factory.js.map b/out/factory.js.map new file mode 100644 index 0000000..0dc8fe3 --- /dev/null +++ b/out/factory.js.map @@ -0,0 +1 @@ +{"version":3,"file":"factory.js","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":";;AAAA,2CAAgC;AAEhC,SAAgB,cAAc,CAAC,IAAY,EAAE,KAAc;IACvD,IAAI,SAAS,GAAG,KAAK,IAAI,EAAE,CAAC;IAE5B,IAAI,KAAK,EAAE;QACP,SAAS,IAAI,MAAM,KAAK,EAAE,CAAC;KAC9B;IAED,MAAM,GAAG,GAAG,oBAAM,CAAC,SAAS,CAAC;;cAEnB,SAAS;;KAElB,CAAC,CAAC;IAEH,OAAQ,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAC5C,CAAC;AAdD,wCAcC"} \ No newline at end of file diff --git a/out/insertProperty.js b/out/insertProperty.js new file mode 100644 index 0000000..4ae1c4e --- /dev/null +++ b/out/insertProperty.js @@ -0,0 +1,141 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const vscode = require("vscode"); +const addPropertyStatement_1 = require("./addPropertyStatement"); +const utils_1 = require("./utils"); +function insertProperty(editor, property, phpClass, anchorText) { + var _a, _b, _c, _d; + let tabStops = { + propertyDocblockType: 1, + propertyDocblockImport: 2, + propertyVisibility: 3, + constructorDocblockType: 4, + constructorDocblockImport: 5, + constructorDocblockDescription: 6, + constructorVisibility: 7, + constructorParameterType: 8, + constructorParameterStop: 9 + }; + const document = editor.document; + const phpClassRange = new vscode.Range(new vscode.Position(phpClass.ast.loc.start.line - 1, phpClass.ast.loc.start.column), new vscode.Position(phpClass.ast.loc.end.line - 1, phpClass.ast.loc.end.column)); + let newDocumentText = addPropertyStatement_1.default(document, phpClass, property, tabStops); + if (!phpClass.getConstructor()) { + let snippet = "\n\n"; + if (utils_1.config('phpAddProperty.constructor.docblock.enable') === true) { + snippet += utils_1.indentText("/**\n") + + utils_1.indentText(" * Constructor.\n") + + utils_1.indentText(`${property.getConstructorParamDocblockText(tabStops)}\n`) + + utils_1.indentText(" */\n"); + } + const visibility = utils_1.config('phpAddProperty.constructor.visibility.default'); + let constructorText = utils_1.indentText(utils_1.config('phpAddProperty.constructor.visibility.choose') === true + ? `\${${tabStops.constructorVisibility}${utils_1.getVisibilityChoice(visibility)}} ` + : `${visibility} `); + const parameterText = property.getParameterText(tabStops); + constructorText += `function __construct(${parameterText})\n` + + utils_1.indentText('{\n') + + utils_1.indentText(`\\$this->${property.getName()} = \\$${property.getName()};\$0\n`, 2) + + utils_1.indentText('}'); + snippet += constructorText; + const searchText = utils_1.escapeForSnippet(anchorText); + newDocumentText = newDocumentText.replace(searchText, `${searchText}${snippet}`); + } + else { + const constructor = (_a = phpClass.getConstructor()) === null || _a === void 0 ? void 0 : _a.ast; + let docblock; + for (let i = 0; i < ((_b = constructor.leadingComments) === null || _b === void 0 ? void 0 : _b.length); i++) { + const node = constructor.leadingComments[i]; + if (node.kind === 'commentblock') { + docblock = node; + break; + } + } + if (docblock) { + const paramRegex = /@param(?:\s+\S+)?\s+\$(\S+).*/g; + let paramExists = false; + let lastParamText; + let paramMatch; + while (paramMatch = paramRegex.exec(docblock.value)) { + lastParamText = paramMatch[0]; + if (paramMatch[1] === property.getName()) { + paramExists = true; + break; + } + } + if (!paramExists) { + if (lastParamText) { + const docblockClosingLine = editor.document.lineAt(docblock.loc.start.line - 1); + newDocumentText = newDocumentText.replace(utils_1.escapeForSnippet(lastParamText), utils_1.escapeForSnippet(lastParamText) + "\n" + utils_1.indentText(property.getConstructorParamDocblockText(tabStops), utils_1.calculateIndentationLevel(utils_1.getLineFirstNonIndentationCharacterIndex(docblockClosingLine.text)))); + } + } + } + let argumentExists = false; + for (let i = 0; i < constructor.arguments.length; i++) { + const node = constructor.arguments[i]; + if (((_c = node.name) === null || _c === void 0 ? void 0 : _c.name) == property.getName()) { + argumentExists = true; + break; + } + } + if (!argumentExists) { + const constructorMethodText = constructor.loc.source; + const constructorHasArgs = constructor.arguments.length > 0; + let newConstructorMethodText = ''; + const isMultiLineConstructor = (/\(\r\n|\r|\n/.test(constructorMethodText)); //constructor.loc.start.line !== constructor.loc.end.line; + const argumentText = property.getParameterText(tabStops); + if (constructorHasArgs) { + const lastArg = constructor.arguments[constructor.arguments.length - 1]; + const lastArgLine = document.lineAt(lastArg.loc.end.line - 1); + let newArg = utils_1.escapeForSnippet(`${lastArg.loc.source}`); + if (isMultiLineConstructor) { + newArg += ",\n" + utils_1.indentText(argumentText, utils_1.calculateIndentationLevel(utils_1.getLineFirstNonIndentationCharacterIndex(lastArgLine.text))); + } + else { + newArg += `, ${argumentText}`; + } + newConstructorMethodText = utils_1.escapeForSnippet(constructorMethodText).replace(utils_1.escapeForSnippet(lastArg.loc.source), newArg); + } + else { + const argsParenthesis = /\(\)/; + newConstructorMethodText = constructorMethodText.replace(argsParenthesis, `(${argumentText})`); + } + newDocumentText = newDocumentText.replace(utils_1.escapeForSnippet(constructorMethodText), newConstructorMethodText); + } + let assignationExists = false; + for (let i = 0; i < ((_d = constructor.body) === null || _d === void 0 ? void 0 : _d.children.length); i++) { + const node = constructor.body.children[i]; + if (node.kind === 'expressionstatement' + && node.expression.kind === 'assign' + && node.expression.left.kind === 'propertylookup' + && node.expression.left.offset.name === property.getName()) { + assignationExists = true; + break; + } + } + if (!assignationExists) { + const constructorBodyText = constructor.body.loc.source; + const constructorBodyLine = document.lineAt(constructor.body.loc.start.line - 1); + const constructorBodyIsEmpty = constructor.body.children.length === 0; + let newConstructorBodyText = ''; + if (constructorBodyIsEmpty) { + const indentationLevel = utils_1.calculateIndentationLevel(utils_1.getLineFirstNonIndentationCharacterIndex(constructorBodyLine.text)); + newConstructorBodyText = "{\n" + utils_1.indentText(`\\$this->${property.getName()} = \\$${property.getName()};\$0\n`, indentationLevel + 1) + utils_1.indentText("}", indentationLevel); + } + else { + const lastChildren = constructor.body.children[constructor.body.children.length - 1]; + const lastChildrenText = lastChildren.loc.source; + const lastChildrenLine = document.lineAt(lastChildren.loc.end.line - 1); + const indentationLevel = utils_1.calculateIndentationLevel(utils_1.getLineFirstNonIndentationCharacterIndex(lastChildrenLine.text)); + newConstructorBodyText = utils_1.escapeForSnippet(constructorBodyText).replace(utils_1.escapeForSnippet(lastChildrenText), utils_1.escapeForSnippet(lastChildrenText) + "\n" + utils_1.indentText(`\\$this->${property.getName()} = \\$${property.getName()};\$0`, indentationLevel)); + } + newDocumentText = newDocumentText.replace(utils_1.escapeForSnippet(constructorBodyText), newConstructorBodyText); + } + } + newDocumentText = utils_1.breakConstructorIntoMultiline(newDocumentText); + if (newDocumentText === utils_1.escapeForSnippet(document.getText(phpClassRange))) { + return; + } + utils_1.replaceWithSnippet(newDocumentText, phpClassRange); +} +exports.default = insertProperty; +//# sourceMappingURL=insertProperty.js.map \ No newline at end of file diff --git a/out/insertProperty.js.map b/out/insertProperty.js.map new file mode 100644 index 0000000..ac22262 --- /dev/null +++ b/out/insertProperty.js.map @@ -0,0 +1 @@ +{"version":3,"file":"insertProperty.js","sourceRoot":"","sources":["../src/insertProperty.ts"],"names":[],"mappings":";;AAAA,iCAAiC;AAGjC,iEAA0D;AAC1D,mCAA4M;AAE5M,SAAwB,cAAc,CAAC,MAAyB,EAAE,QAAkB,EAAE,QAAkB,EAAE,UAAkB;;IAC3H,IAAI,QAAQ,GAAG;QACd,oBAAoB,EAAE,CAAC;QACvB,sBAAsB,EAAE,CAAC;QACzB,kBAAkB,EAAE,CAAC;QACrB,uBAAuB,EAAE,CAAC;QAC1B,yBAAyB,EAAE,CAAC;QAC5B,8BAA8B,EAAE,CAAC;QACjC,qBAAqB,EAAE,CAAC;QACxB,wBAAwB,EAAE,CAAC;QAC3B,wBAAwB,EAAE,CAAC;KAC3B,CAAC;IAEF,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;IACjC,MAAM,aAAa,GAAG,IAAI,MAAM,CAAC,KAAK,CACrC,IAAI,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,EAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,EACnF,IAAI,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,EAAE,QAAQ,CAAC,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e,CAAC,OAAO,CAAC,wBAAgB,CAAC,mBAAmB,CAAC,EAAE,sBAAsB,CAAC,CAAC;SACzG;KACD;IAED,eAAe,GAAG,qCAA6B,CAAC,eAAe,CAAC,CAAC;IAEjE,IAAI,eAAe,KAAK,wBAAgB,CAAC,QAAQ,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,EAAE;QAC1E,OAAO;KACP;IAED,0BAAkB,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC;AACpD,CAAC;AAxMD,iCAwMC"} \ No newline at end of file diff --git a/out/locator.js b/out/locator.js new file mode 100644 index 0000000..3bdc91d --- /dev/null +++ b/out/locator.js @@ -0,0 +1,58 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const class_1 = require("./class"); +const constructor_1 = require("./constructor"); +class Locator { + constructor(ast) { + this.ast = ast; + } + findClass(cursorAtLine) { + let firstClass; + const cursorClass = filter(this.ast, 'class', function (node) { + if (!firstClass) { + firstClass = new class_1.default(node); + } + if (!cursorAtLine || (cursorAtLine >= node.loc.start.line && cursorAtLine <= node.loc.end.line)) { + return new class_1.default(node); + } + }); + return cursorClass || firstClass; + } + findConstructor() { + return filter(this.ast, 'method', function (node) { + var _a; + if (((_a = node.name) === null || _a === void 0 ? void 0 : _a.name) === '__construct') { + return new constructor_1.default(node); + } + }); + } +} +exports.default = Locator; +function filter(ast, kind, matcher) { + let result; + if (Array.isArray(ast)) { + for (var i = 0; i < ast.length; i++) { + result = filter(ast[i], kind, matcher); + if (result) { + return result; + } + } + } + else { + if ((ast === null || ast === void 0 ? void 0 : ast.kind) === kind) { + result = matcher(ast); + if (result) { + return result; + } + } + for (const node in ast) { + if (ast.hasOwnProperty(node) && ast[node] !== ast) { + result = filter(ast[node], kind, matcher); + if (result) { + return result; + } + } + } + } +} +//# sourceMappingURL=locator.js.map \ No newline at end of file diff --git a/out/locator.js.map b/out/locator.js.map new file mode 100644 index 0000000..593ad47 --- /dev/null +++ b/out/locator.js.map @@ -0,0 +1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AG,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;YACvC,IAAI,MAAM,EAAE;gBACR,OAAO,MAAM,CAAC;aACjB;SACJ;KACJ;SAAM;QACH,IAAI,CAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,IAAI,MAAK,IAAI,EAAE;YACpB,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;YAEtB,IAAI,MAAM,EAAE;gBACR,OAAO,MAAM,CAAC;aACjB;SACJ;QAED,KAAK,MAAM,IAAI,IAAI,GAAG,EAAE;YACpB,IAAI,GAAG,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,KAAK,GAAG,EAAE;gBAC/C,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;gBAC1C,IAAI,MAAM,EAAE;oBACR,OAAO,MAAM,CAAC;iBACjB;aACJ;SACJ;KACJ;AACL,CAAC"} \ No newline at end of file diff --git a/out/property.js b/out/property.js new file mode 100644 index 0000000..82558f9 --- /dev/null +++ b/out/property.js @@ -0,0 +1,100 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const utils_1 = require("./utils"); +class Property { + constructor(name, nullable = false, type) { + this.name = name; + this.nullable = nullable; + this.type = type; + } + getName() { + return this.name; + } + isNullable() { + return this.nullable === true; + } + getType() { + return this.type; + } + getStatementText(tabStops) { + let docblockTypeStop = tabStops.propertyDocblockType; + let dockblockImportStop = tabStops.propertyDocblockImport; + if (utils_1.config('phpAddProperty.property.docblock.withParameter') === true) { + docblockTypeStop = tabStops.constructorParameterType; + dockblockImportStop = tabStops.constructorParameterStop; + tabStops.constructorParameterStop++; + } + let propertyStatementText = ''; + if (utils_1.config('phpAddProperty.property.docblock.add') === true) { + let stopText = ''; + if (utils_1.config('phpAddProperty.property.docblock.stopToImport') === true) { + stopText += `$${dockblockImportStop}`; + } + stopText += `$${docblockTypeStop}`; + if (utils_1.config('phpAddProperty.property.docblock.multiline') === true) { + propertyStatementText += `/**\n${utils_1.indentText(' * @var ')}${stopText}\n${utils_1.indentText(' */')}\n${utils_1.indentText('')}`; + } + else { + if (utils_1.config('phpAddProperty.property.docblock.withParameter') === false) { + stopText += ' '; + } + propertyStatementText += `/** @var ${stopText}*/\n${utils_1.indentText('')}`; + } + } + const visibility = utils_1.config('phpAddProperty.property.visibility.default'); + propertyStatementText += utils_1.config('phpAddProperty.property.visibility.choose') === true + ? `\${${tabStops.propertyVisibility}${utils_1.getVisibilityChoice(visibility)}} ` + : `${visibility} `; + if (utils_1.config('phpAddProperty.property.types') === true) { + propertyStatementText += `$${tabStops.constructorParameterType}`; + } + propertyStatementText += `\\$${this.getName()};`; + return propertyStatementText; + } + getParameterText(tabStops) { + let tabStopsText = `$${tabStops.constructorParameterType}`; + if (this.getType()) { + let typeText = this.getType(); + if (this.isNullable()) { + typeText = `?${typeText}`; + } + tabStopsText = `\${${tabStops.constructorParameterType}:${typeText}}`; + } + if (utils_1.config('phpAddProperty.property.stopToImport') === true) { + tabStopsText += `$${tabStops.constructorParameterStop}`; + } + let parameterText = `${tabStopsText}`; + if (this.getType()) { + parameterText += ' '; + } + parameterText += `\\$${this.getName()}`; + return parameterText; + } + getConstructorParamDocblockText(tabStops) { + let docblockTypeStop = tabStops.constructorDocblockType; + let dockblockImportStop = tabStops.constructorDocblockImport; + if (utils_1.config('phpAddProperty.constructor.docblock.withParameter') === true) { + docblockTypeStop = tabStops.constructorParameterType; + dockblockImportStop = tabStops.constructorParameterStop; + tabStops.constructorParameterStop++; + } + let constructorParamDocblockText = `\${${docblockTypeStop}}`; + if (this.getType()) { + let typeText = this.getType(); + if (this.isNullable()) { + typeText = `${typeText}|null`; + } + constructorParamDocblockText = `\${${docblockTypeStop}:${typeText}} `; + } + if (utils_1.config('phpAddProperty.constructor.docblock.stopToImport') === true) { + constructorParamDocblockText += `\$${dockblockImportStop}`; + } + constructorParamDocblockText += `\\$${this.getName()}`; + if (utils_1.config('phpAddProperty.constructor.docblock.stopForDescription') === true) { + constructorParamDocblockText += `\$${tabStops.constructorDocblockDescription}`; + } + return ` * @param ${constructorParamDocblockText}`; + } +} +exports.default = Property; +//# sourceMappingURL=property.js.map \ No newline at end of file diff --git a/out/property.js.map b/out/property.js.map new file mode 100644 index 0000000..927e838 --- /dev/null +++ b/out/property.js.map @@ -0,0 +1 @@ +{"version":3,"file":"property.js","sourceRoot":"","sources":["../src/property.ts"],"names":[],"mappings":";;AAAA,mCAAkE;AAElE,MAAqB,QAAQ;IAKzB,YAAY,IAAY,EAAE,WAAoB,KAAK,EAAE,IAAa;QAC9D,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACrB,CAAC;IAEM,OAAO;QACV,OAAO,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;IAEM,UAAU;QACb,OAAO,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC;IAClC,CAAC;IAEM,OAAO;QACV,OAAO,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;IAEM,gBAAgB,CAAC,QAAa;QACjC,IAAI,gBAAgB,GAAG,QAAQ,CAAC,oBAAoB,CAAC;QACrD,IAAI,mBAAmB,GAAG,QAAQ,CAAC,sBAAsB,CAAC;QAE1D,IAAI,cAAM,CAAC,gDAAgD,CAAC,KAAK,IAAI,EAAE;YACnE,gBAAgB,GAAG,QAAQ,CAAC,wBAAwB,CAAC;YACrD,mBAAmB,GAAG,QAAQ,CAAC,wBAAwB,CAAC;YACxD,QAAQ,CAAC,wBAAwB,EAAE,CAAC;SACvC;QAED,IAAI,qBAAqB,GAAG,EAAE,CAAC;QAC/B,IAAI,cAAM,CAAC,sCAAsC,CAAC,KAAK,IAAI,EAAE;YACzD,IAAI,QAAQ,GAAG,EAAE,CAAC;YAElB,IAAI,cAAM,CA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A4B,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;QAEvD,IAAI,cAAM,CAAC,wDAAwD,CAAC,KAAK,IAAI,EAAE;YAC3E,4BAA4B,IAAI,KAAK,QAAQ,CAAC,8BAA8B,EAAE,CAAC;SAClF;QAED,OAAO,aAAa,4BAA4B,EAAE,CAAC;IACvD,CAAC;CACJ;AAjID,2BAiIC"} \ No newline at end of file diff --git a/out/removeProperty.js b/out/removeProperty.js new file mode 100644 index 0000000..71c3c69 --- /dev/null +++ b/out/removeProperty.js @@ -0,0 +1,105 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const vscode = require("vscode"); +const utils_1 = require("./utils"); +function removeProperty(editor, property, phpClass) { + var _a, _b, _c, _d, _e, _f, _g, _h, _j; + const document = editor.document; + const phpClassRange = new vscode.Range(new vscode.Position(phpClass.ast.loc.start.line - 1, phpClass.ast.loc.start.column), new vscode.Position(phpClass.ast.loc.end.line - 1, phpClass.ast.loc.end.column)); + let newDocumentText = document.getText(phpClassRange); + const astClassBody = phpClass.ast.body; + for (let i = 0; i < astClassBody.length; i++) { + const node = astClassBody[i]; + if (node.kind === 'propertystatement') { + for (let j = 0; j < node.properties.length; j++) { + const propertyNode = node.properties[j]; + if (((_a = propertyNode.name) === null || _a === void 0 ? void 0 : _a.name) === property.getName()) { + if (node.properties.length === 1) { + let nextNotEmptyLine = node.loc.end.line; + if (i + 1 < astClassBody.length) { + const nextNode = astClassBody[i + 1]; + const startLine = nextNode.leadingComments + ? nextNode.leadingComments[0].loc.start.line + : nextNode.loc.start.line; + nextNotEmptyLine = startLine - 1; + } + const propertyStatementRange = new vscode.Range(new vscode.Position(node.loc.start.line - 1, 0), new vscode.Position(nextNotEmptyLine, 0)); + const propertyStatementText = document.getText(propertyStatementRange); + newDocumentText = newDocumentText.replace(propertyStatementText, ''); + } + else { + const regexp = new RegExp(`(,\\s*(?!.*,))?${utils_1.escapeForRegExp(propertyNode.loc.source)}(\\s*,\\s*)?`); + newDocumentText = newDocumentText.replace(regexp, ''); + } + for (let i = 0; i < ((_b = node.leadingComments) === null || _b === void 0 ? void 0 : _b.length); i++) { + const commentNode = node.leadingComments[i]; + const commentRange = new vscode.Range(new vscode.Position(commentNode.loc.start.line - 1, 0), new vscode.Position(commentNode.loc.end.line, 0)); + const commentText = document.getText(commentRange); + newDocumentText = newDocumentText.replace(commentText, ''); + } + break; + } + } + } + } + const constructor = phpClass.getConstructor(); + if (constructor) { + if (((_c = constructor.ast.body) === null || _c === void 0 ? void 0 : _c.children.length) <= 1) { + const node = constructor.ast.arguments[0]; + if (constructor.ast.body.children.length == 0 || ((_d = node.name) === null || _d === void 0 ? void 0 : _d.name) == property.getName()) { + const constructorRange = new vscode.Range(new vscode.Position(constructor.ast.loc.start.line - 1, 0), new vscode.Position(constructor.ast.loc.end.line, 0)); + const constructorText = document.getText(constructorRange); + newDocumentText = newDocumentText.replace(constructorText, ''); + for (let i = 0; i < ((_e = constructor.ast.leadingComments) === null || _e === void 0 ? void 0 : _e.length); i++) { + const commentNode = constructor.ast.leadingComments[i]; + const commentRange = new vscode.Range(new vscode.Position(commentNode.loc.start.line - 1, 0), new vscode.Position(commentNode.loc.end.line, 0)); + const commentText = document.getText(commentRange); + newDocumentText = newDocumentText.replace(commentText, ''); + } + } + } + else { + for (let i = 0; i < constructor.ast.arguments.length; i++) { + const node = constructor.ast.arguments[i]; + if (((_f = node.name) === null || _f === void 0 ? void 0 : _f.name) == property.getName()) { + const constructorText = constructor.ast.loc.source; + const regexp = new RegExp(`(,\\s*(?!.*,))?${utils_1.escapeForRegExp(node.loc.source)}(\\s*,\\s*)?`); + const newConstructorText = constructorText.replace(regexp, ''); + newDocumentText = newDocumentText.replace(constructorText, newConstructorText); + break; + } + } + for (let i = 0; i < ((_g = constructor.ast.body) === null || _g === void 0 ? void 0 : _g.children.length); i++) { + const node = constructor.ast.body.children[i]; + if (node.kind === 'expressionstatement' + && node.expression.kind === 'assign' + && node.expression.left.kind === 'propertylookup' + && node.expression.left.offset.name === property.getName()) { + const propertyAssignmentRange = new vscode.Range(new vscode.Position(node.loc.start.line - 1, 0), new vscode.Position(node.loc.end.line, 0)); + const propertyAssignmentText = document.getText(propertyAssignmentRange); + newDocumentText = newDocumentText.replace(propertyAssignmentText, ''); + break; + } + } + for (let i = 0; i < ((_h = constructor.ast.leadingComments) === null || _h === void 0 ? void 0 : _h.length); i++) { + const commentNode = constructor.ast.leadingComments[i]; + const commentRange = new vscode.Range(new vscode.Position(commentNode.loc.start.line - 1, 0), new vscode.Position(commentNode.loc.end.line, 0)); + const commentText = document.getText(commentRange); + const regexp = new RegExp(`.*\\*.*\\$${property.getName()}\\s*[\r\n]+`); + const newCommentText = commentText.replace(regexp, ''); + newDocumentText = newDocumentText.replace(commentText, newCommentText); + } + } + } + if (newDocumentText === document.getText(phpClassRange)) { + return; + } + (_j = vscode.window.activeTextEditor) === null || _j === void 0 ? void 0 : _j.edit(editBuilder => { + editBuilder.replace(phpClassRange, newDocumentText); + }, { + undoStopBefore: true, + undoStopAfter: false + }); +} +exports.removeProperty = removeProperty; +//# sourceMappingURL=removeProperty.js.map \ No newline at end of file diff --git a/out/removeProperty.js.map b/out/removeProperty.js.map new file mode 100644 index 0000000..9cd5b0b --- /dev/null +++ b/out/removeProperty.js.map @@ -0,0 +1 @@ +{"version":3,"file":"removeProperty.js","sourceRoot":"","sources":["../src/removeProperty.ts"],"names":[],"mappings":";;AAAA,iCAAiC;AAGjC,mCAA0C;AAE1C,SAAgB,cAAc,CAAC,MAAyB,EAAE,QAAkB,EAAE,QAAe;;IAC5F,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;IACjC,MAAM,aAAa,GAAG,IAAI,MAAM,CAAC,KAAK,CACrC,IAAI,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,EAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,C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AM,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;gBAEnD,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,aAAa,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;gBACxE,MAAM,cAAc,GAAG,WAAW,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;gBAEvD,eAAe,GAAG,eAAe,CAAC,OAAO,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;aACvE;SACD;KACD;IAED,IAAI,eAAe,KAAK,QAAQ,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE;QACxD,OAAO;KACP;IAED,MAAA,MAAM,CAAC,MAAM,CAAC,gBAAgB,0CAAE,IAAI,CACnC,WAAW,CAAC,EAAE;QACb,WAAW,CAAC,OAAO,CAAC,aAAa,EAAE,eAAe,CAAC,CAAC;IACrD,CAAC,EACD;QACC,cAAc,EAAE,IAAI;QACpB,aAAa,EAAE,KAAK;KACpB,EACA;AACH,CAAC;AA5JD,wCA4JC"} \ No newline at end of file diff --git a/out/renameProperty.js b/out/renameProperty.js new file mode 100644 index 0000000..189889a --- /dev/null +++ b/out/renameProperty.js @@ -0,0 +1,122 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const vscode = require("vscode"); +function renameProperty(editor, property, newProperty, phpClass) { + var _a, _b, _c, _d, _e, _f; + const document = editor.document; + const phpClassRange = new vscode.Range(new vscode.Position(phpClass.ast.loc.start.line - 1, phpClass.ast.loc.start.column), new vscode.Position(phpClass.ast.loc.end.line - 1, phpClass.ast.loc.end.column)); + let newDocumentText = document.getText(phpClassRange); + const astClassBody = phpClass.ast.body; + for (let i = 0; i < astClassBody.length; i++) { + const node = astClassBody[i]; + if (node.kind === 'propertystatement') { + for (let j = 0; j < node.properties.length; j++) { + const propertyNode = node.properties[j]; + if (((_a = propertyNode.name) === null || _a === void 0 ? void 0 : _a.name) === property.getName()) { + if (node.properties.length === 1) { + const propertyStatementRange = new vscode.Range(new vscode.Position(node.loc.start.line - 1, 0), new vscode.Position(node.loc.end.line, 0)); + const propertyStatementText = document.getText(propertyStatementRange); + const newPropertyStatementText = propertyStatementText.replace(property.getName(), newProperty.getName()); + newDocumentText = newDocumentText.replace(propertyStatementText, newPropertyStatementText); + } + else { + const regexp = new RegExp(`\\$${property.getName()}(\\s*,|\\s*;)`); + newDocumentText = newDocumentText.replace(regexp, `\$${newProperty.getName()}$1`); + } + break; + } + } + } + } + const constructor = phpClass.getConstructor(); + if (constructor) { + if (constructor.ast.arguments.length == 1) { + const node = constructor.ast.arguments[0]; + if (((_b = node.name) === null || _b === void 0 ? void 0 : _b.name) == property.getName()) { + const constructorText = constructor.ast.loc.source; + const newConstructorText = constructorText.replace(`\$${property.getName()}`, `\$${newProperty.getName()}`); + newDocumentText = newDocumentText.replace(constructorText, newConstructorText); + } + } + else { + for (let i = 0; i < constructor.ast.arguments.length; i++) { + const node = constructor.ast.arguments[i]; + if (((_c = node.name) === null || _c === void 0 ? void 0 : _c.name) == property.getName()) { + const constructorText = constructor.ast.loc.source; + const newConstructorText = constructorText.replace(`\$${property.getName()},`, `\$${newProperty.getName()},`); + newDocumentText = newDocumentText.replace(constructorText, newConstructorText); + break; + } + } + } + for (let i = 0; i < ((_d = constructor.ast.body) === null || _d === void 0 ? void 0 : _d.children.length); i++) { + const node = constructor.ast.body.children[i]; + if (node.kind === 'expressionstatement' + && node.expression.kind === 'assign' + && node.expression.left.kind === 'propertylookup' + && node.expression.left.offset.name === property.getName()) { + const propertyAssignmentRange = new vscode.Range(new vscode.Position(node.loc.start.line - 1, 0), new vscode.Position(node.loc.end.line, 0)); + const propertyAssignmentText = document.getText(propertyAssignmentRange); + let newPropertyAssignmentText = propertyAssignmentText.replace(property.getName(), newProperty.getName()); + if (node.expression.right.kind === 'variable' && node.expression.right.name === property.getName()) { + newPropertyAssignmentText = newPropertyAssignmentText.replace(`\$${property.getName()}`, `\$${newProperty.getName()}`); + } + newDocumentText = newDocumentText.replace(propertyAssignmentText, newPropertyAssignmentText); + break; + } + } + for (let i = 0; i < ((_e = constructor.ast.leadingComments) === null || _e === void 0 ? void 0 : _e.length); i++) { + const commentNode = constructor.ast.leadingComments[i]; + const commentRange = new vscode.Range(new vscode.Position(commentNode.loc.start.line - 1, 0), new vscode.Position(commentNode.loc.end.line, 0)); + const commentText = document.getText(commentRange); + const regexp = new RegExp(`\\$${property.getName()}(\\s+)`); + const newCommentText = commentText.replace(regexp, `\$${newProperty.getName()}$1`); + newDocumentText = newDocumentText.replace(commentText, newCommentText); + } + } + const propertyReferences = findPropertyReferences(phpClass.ast, property.getName()); + for (let i = 0; i < propertyReferences.length; i++) { + const node = propertyReferences[i]; + const propertyReferenceRange = new vscode.Range(new vscode.Position(node.loc.start.line - 1, 0), new vscode.Position(node.loc.end.line, 0)); + const propertyReferenceText = document.getText(propertyReferenceRange); + const newPropertyReferenceText = propertyReferenceText.replace(`this->${property.getName()}`, `this->${newProperty.getName()}`); + newDocumentText = newDocumentText.replace(propertyReferenceText, newPropertyReferenceText); + } + if (newDocumentText === document.getText(phpClassRange)) { + return; + } + (_f = vscode.window.activeTextEditor) === null || _f === void 0 ? void 0 : _f.edit(editBuilder => { + editBuilder.replace(phpClassRange, newDocumentText); + }, { + undoStopBefore: true, + undoStopAfter: false + }); +} +exports.renameProperty = renameProperty; +function findPropertyReferences(ast, name) { + var _a; + let propertyReferences = []; + if (Array.isArray(ast)) { + for (var i = 0; i < ast.length; i++) { + const newPropertyReferences = findPropertyReferences(ast[i], name); + for (let i = 0; i < newPropertyReferences.length; i++) { + propertyReferences.push(newPropertyReferences[i]); + } + } + } + else { + if ((ast === null || ast === void 0 ? void 0 : ast.kind) === 'propertylookup' && ((_a = ast.offset) === null || _a === void 0 ? void 0 : _a.name) === name) { + return [ast]; + } + for (const node in ast) { + if (ast.hasOwnProperty(node) && ast[node] !== ast) { + const newPropertyReferences = findPropertyReferences(ast[node], name); + for (let i = 0; i < newPropertyReferences.length; i++) { + propertyReferences.push(newPropertyReferences[i]); + } + } + } + } + return propertyReferences; +} +//# sourceMappingURL=renameProperty.js.map \ No newline at end of file diff --git a/out/renameProperty.js.map b/out/renameProperty.js.map new file mode 100644 index 0000000..1dfd5a9 --- /dev/null +++ b/out/renameProperty.js.map @@ -0,0 +1 @@ +{"version":3,"file":"renameProperty.js","sourceRoot":"","sources":["../src/renameProperty.ts"],"names":[],"mappings":";;AAAA,iCAAiC;AAIjC,SAAgB,cAAc,CAAC,MAAyB,EAAE,QAAkB,EAAE,WAAqB,EAAE,QAAe;;IACnH,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;IACjC,MAAM,aAAa,GAAG,IAAI,MAAM,CAAC,KAAK,CACrC,IAAI,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,EAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,EACnF,IAAI,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,EAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAC/E,CAAC;IAEF,IAAI,eAAe,GAAG,QAAQ,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IAEtD,MAAM,YAAY,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC;IACvC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAC7C,MAAM,IAAI,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;QAE7B,IAAI,IAAI,CAAC,IAAI,KAAK,mBAAmB,EAAE;YACtC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,E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AG,aAAH,GAAG,uBAAH,GAAG,CAAE,IAAI,MAAK,gBAAgB,IAAI,OAAA,GAAG,CAAC,MAAM,0CAAE,IAAI,MAAK,IAAI,EAAE;YAChE,OAAO,CAAC,GAAG,CAAC,CAAC;SACb;QAEK,KAAK,MAAM,IAAI,IAAI,GAAG,EAAE;YACpB,IAAI,GAAG,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,KAAK,GAAG,EAAE;gBAC3D,MAAM,qBAAqB,GAAG,sBAAsB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;gBACtE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,qBAAqB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;oBACtD,kBAAkB,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC;iBAClD;aACQ;SACJ;KACP;IAED,OAAO,kBAAkB,CAAC;AAC3B,CAAC"} \ No newline at end of file diff --git a/test/fixtures/customizations/inputs/ConstructorBreakIntoMultilineLength.php b/out/test/fixtures/breakConstructorIntoMultiline/inputs/Constructor.php similarity index 100% rename from test/fixtures/customizations/inputs/ConstructorBreakIntoMultilineLength.php rename to out/test/fixtures/breakConstructorIntoMultiline/inputs/Constructor.php diff --git a/test/fixtures/new/inputs/MultilineConstructor.php b/out/test/fixtures/breakConstructorIntoMultiline/outputs/Constructor.php similarity index 100% rename from test/fixtures/new/inputs/MultilineConstructor.php rename to out/test/fixtures/breakConstructorIntoMultiline/outputs/Constructor.php diff --git a/out/test/fixtures/changePropertyType/inputs/ConstructorDocblock.php b/out/test/fixtures/changePropertyType/inputs/ConstructorDocblock.php new file mode 100644 index 0000000..838e025 --- /dev/null +++ b/out/test/fixtures/changePropertyType/inputs/ConstructorDocblock.php @@ -0,0 +1,25 @@ +class = $class; + $this->name = $name; + $this->rank = $rank; + } +} diff --git a/out/test/fixtures/changePropertyType/inputs/ConstructorWithMultipleProperties.php b/out/test/fixtures/changePropertyType/inputs/ConstructorWithMultipleProperties.php new file mode 100644 index 0000000..74d99da --- /dev/null +++ b/out/test/fixtures/changePropertyType/inputs/ConstructorWithMultipleProperties.php @@ -0,0 +1,20 @@ +class = $class; + $this->name = $name; + $this->rank = $rank; + } +} diff --git a/out/test/fixtures/changePropertyType/inputs/ConstructorWithMultiplePropertiesCursorInConstructorDocblock.php b/out/test/fixtures/changePropertyType/inputs/ConstructorWithMultiplePropertiesCursorInConstructorDocblock.php new file mode 100644 index 0000000..838e025 --- /dev/null +++ b/out/test/fixtures/changePropertyType/inputs/ConstructorWithMultiplePropertiesCursorInConstructorDocblock.php @@ -0,0 +1,25 @@ +class = $class; + $this->name = $name; + $this->rank = $rank; + } +} diff --git a/out/test/fixtures/changePropertyType/inputs/OtherPropertiesStatementDocblock.php b/out/test/fixtures/changePropertyType/inputs/OtherPropertiesStatementDocblock.php new file mode 100644 index 0000000..3096006 --- /dev/null +++ b/out/test/fixtures/changePropertyType/inputs/OtherPropertiesStatementDocblock.php @@ -0,0 +1,19 @@ +class = $class; + $this->name = $name; + } +} diff --git a/test/fixtures/existing/outputs/UseDocblock.php b/out/test/fixtures/changePropertyType/inputs/PropertyStatementDocblock.php similarity index 100% rename from test/fixtures/existing/outputs/UseDocblock.php rename to out/test/fixtures/changePropertyType/inputs/PropertyStatementDocblock.php diff --git a/test/fixtures/existing/outputs/EmptyClass.php b/out/test/fixtures/changePropertyType/inputs/PropertyWithoutType.php similarity index 100% rename from test/fixtures/existing/outputs/EmptyClass.php rename to out/test/fixtures/changePropertyType/inputs/PropertyWithoutType.php diff --git a/out/test/fixtures/changePropertyType/inputs/TypedPropertyStatement.php b/out/test/fixtures/changePropertyType/inputs/TypedPropertyStatement.php new file mode 100644 index 0000000..ffff80a --- /dev/null +++ b/out/test/fixtures/changePropertyType/inputs/TypedPropertyStatement.php @@ -0,0 +1,14 @@ +name = $name; + } +} diff --git a/out/test/fixtures/changePropertyType/outputs/ConstructorDocblock.php b/out/test/fixtures/changePropertyType/outputs/ConstructorDocblock.php new file mode 100644 index 0000000..bd069a8 --- /dev/null +++ b/out/test/fixtures/changePropertyType/outputs/ConstructorDocblock.php @@ -0,0 +1,25 @@ +class = $class; + $this->name = $name; + $this->rank = $rank; + } +} diff --git a/out/test/fixtures/changePropertyType/outputs/ConstructorWithMultipleProperties.php b/out/test/fixtures/changePropertyType/outputs/ConstructorWithMultipleProperties.php new file mode 100644 index 0000000..17d6a3f --- /dev/null +++ b/out/test/fixtures/changePropertyType/outputs/ConstructorWithMultipleProperties.php @@ -0,0 +1,20 @@ +class = $class; + $this->name = $name; + $this->rank = $rank; + } +} diff --git a/out/test/fixtures/changePropertyType/outputs/ConstructorWithMultiplePropertiesCursorInConstructorDocblock.php b/out/test/fixtures/changePropertyType/outputs/ConstructorWithMultiplePropertiesCursorInConstructorDocblock.php new file mode 100644 index 0000000..bd069a8 --- /dev/null +++ b/out/test/fixtures/changePropertyType/outputs/ConstructorWithMultiplePropertiesCursorInConstructorDocblock.php @@ -0,0 +1,25 @@ +class = $class; + $this->name = $name; + $this->rank = $rank; + } +} diff --git a/out/test/fixtures/changePropertyType/outputs/OtherPropertiesStatementDocblock.php b/out/test/fixtures/changePropertyType/outputs/OtherPropertiesStatementDocblock.php new file mode 100644 index 0000000..af58951 --- /dev/null +++ b/out/test/fixtures/changePropertyType/outputs/OtherPropertiesStatementDocblock.php @@ -0,0 +1,19 @@ +class = $class; + $this->name = $name; + } +} diff --git a/out/test/fixtures/changePropertyType/outputs/PropertyStatementDocblock.php b/out/test/fixtures/changePropertyType/outputs/PropertyStatementDocblock.php new file mode 100644 index 0000000..df2702c --- /dev/null +++ b/out/test/fixtures/changePropertyType/outputs/PropertyStatementDocblock.php @@ -0,0 +1,15 @@ +name = $name; + } +} diff --git a/out/test/fixtures/changePropertyType/outputs/PropertyWithoutType.php b/out/test/fixtures/changePropertyType/outputs/PropertyWithoutType.php new file mode 100644 index 0000000..d7c6716 --- /dev/null +++ b/out/test/fixtures/changePropertyType/outputs/PropertyWithoutType.php @@ -0,0 +1,14 @@ +name = $name; + } +} diff --git a/out/test/fixtures/changePropertyType/outputs/TypedPropertyStatement.php b/out/test/fixtures/changePropertyType/outputs/TypedPropertyStatement.php new file mode 100644 index 0000000..d7c6716 --- /dev/null +++ b/out/test/fixtures/changePropertyType/outputs/TypedPropertyStatement.php @@ -0,0 +1,14 @@ +name = $name; + } +} diff --git a/test/fixtures/customizations/inputs/ConstructorBreakIntoMultiline.php b/out/test/fixtures/customizations/inputs/ConstructorBreakIntoMultiline.php similarity index 100% rename from test/fixtures/customizations/inputs/ConstructorBreakIntoMultiline.php rename to out/test/fixtures/customizations/inputs/ConstructorBreakIntoMultiline.php diff --git a/test/fixtures/new/inputs/ExistingConstructor.php b/out/test/fixtures/customizations/inputs/ConstructorBreakIntoMultilineLength.php similarity index 100% rename from test/fixtures/new/inputs/ExistingConstructor.php rename to out/test/fixtures/customizations/inputs/ConstructorBreakIntoMultilineLength.php diff --git a/test/fixtures/customizations/inputs/ConstructorDefaultVisibility.php b/out/test/fixtures/customizations/inputs/ConstructorDefaultVisibility.php similarity index 100% rename from test/fixtures/customizations/inputs/ConstructorDefaultVisibility.php rename to out/test/fixtures/customizations/inputs/ConstructorDefaultVisibility.php diff --git a/test/fixtures/customizations/inputs/PropertyAddDocblock.php b/out/test/fixtures/customizations/inputs/PropertyAddDocblock.php similarity index 100% rename from test/fixtures/customizations/inputs/PropertyAddDocblock.php rename to out/test/fixtures/customizations/inputs/PropertyAddDocblock.php diff --git a/test/fixtures/customizations/inputs/PropertyDefaultVisibility.php b/out/test/fixtures/customizations/inputs/PropertyDefaultVisibility.php similarity index 100% rename from test/fixtures/customizations/inputs/PropertyDefaultVisibility.php rename to out/test/fixtures/customizations/inputs/PropertyDefaultVisibility.php diff --git a/test/fixtures/customizations/inputs/PropertyMultilineDocblock.php b/out/test/fixtures/customizations/inputs/PropertyMultilineDocblock.php similarity index 100% rename from test/fixtures/customizations/inputs/PropertyMultilineDocblock.php rename to out/test/fixtures/customizations/inputs/PropertyMultilineDocblock.php diff --git a/test/fixtures/customizations/outputs/ConstructorBreakIntoMultiline.php b/out/test/fixtures/customizations/outputs/ConstructorBreakIntoMultiline.php similarity index 100% rename from test/fixtures/customizations/outputs/ConstructorBreakIntoMultiline.php rename to out/test/fixtures/customizations/outputs/ConstructorBreakIntoMultiline.php diff --git a/test/fixtures/customizations/outputs/ConstructorBreakIntoMultilineLength.php b/out/test/fixtures/customizations/outputs/ConstructorBreakIntoMultilineLength.php similarity index 100% rename from test/fixtures/customizations/outputs/ConstructorBreakIntoMultilineLength.php rename to out/test/fixtures/customizations/outputs/ConstructorBreakIntoMultilineLength.php diff --git a/test/fixtures/customizations/outputs/ConstructorDefaultVisibility.php b/out/test/fixtures/customizations/outputs/ConstructorDefaultVisibility.php similarity index 100% rename from test/fixtures/customizations/outputs/ConstructorDefaultVisibility.php rename to out/test/fixtures/customizations/outputs/ConstructorDefaultVisibility.php diff --git a/test/fixtures/customizations/outputs/PropertyAddDocblock.php b/out/test/fixtures/customizations/outputs/PropertyAddDocblock.php similarity index 100% rename from test/fixtures/customizations/outputs/PropertyAddDocblock.php rename to out/test/fixtures/customizations/outputs/PropertyAddDocblock.php diff --git a/test/fixtures/customizations/outputs/PropertyDefaultVisibility.php b/out/test/fixtures/customizations/outputs/PropertyDefaultVisibility.php similarity index 100% rename from test/fixtures/customizations/outputs/PropertyDefaultVisibility.php rename to out/test/fixtures/customizations/outputs/PropertyDefaultVisibility.php diff --git a/test/fixtures/customizations/outputs/PropertyMultilineDocblock.php b/out/test/fixtures/customizations/outputs/PropertyMultilineDocblock.php similarity index 100% rename from test/fixtures/customizations/outputs/PropertyMultilineDocblock.php rename to out/test/fixtures/customizations/outputs/PropertyMultilineDocblock.php diff --git a/test/fixtures/existing/inputs/ConstructorDocblockUsingDocblock.php b/out/test/fixtures/existing/inputs/ConstructorDocblockUsingDocblock.php similarity index 100% rename from test/fixtures/existing/inputs/ConstructorDocblockUsingDocblock.php rename to out/test/fixtures/existing/inputs/ConstructorDocblockUsingDocblock.php diff --git a/out/test/fixtures/existing/inputs/DocblockTypeWithParameter.php b/out/test/fixtures/existing/inputs/DocblockTypeWithParameter.php new file mode 100644 index 0000000..f41691d --- /dev/null +++ b/out/test/fixtures/existing/inputs/DocblockTypeWithParameter.php @@ -0,0 +1,12 @@ +name = $name; + } +} diff --git a/test/fixtures/new/outputs/EmptyClass.php b/out/test/fixtures/existing/outputs/EmptyClass.php similarity index 100% rename from test/fixtures/new/outputs/EmptyClass.php rename to out/test/fixtures/existing/outputs/EmptyClass.php diff --git a/test/fixtures/existing/outputs/EmptyConstructor.php b/out/test/fixtures/existing/outputs/EmptyConstructor.php similarity index 100% rename from test/fixtures/existing/outputs/EmptyConstructor.php rename to out/test/fixtures/existing/outputs/EmptyConstructor.php diff --git a/test/fixtures/existing/outputs/ExistingConstructor.php b/out/test/fixtures/existing/outputs/ExistingConstructor.php similarity index 100% rename from test/fixtures/existing/outputs/ExistingConstructor.php rename to out/test/fixtures/existing/outputs/ExistingConstructor.php diff --git a/out/test/fixtures/existing/outputs/NullableType.php b/out/test/fixtures/existing/outputs/NullableType.php new file mode 100644 index 0000000..c1e98af --- /dev/null +++ b/out/test/fixtures/existing/outputs/NullableType.php @@ -0,0 +1,21 @@ +name = $name; + } +} diff --git a/out/test/fixtures/existing/outputs/UseDocblock.php b/out/test/fixtures/existing/outputs/UseDocblock.php new file mode 100644 index 0000000..6039468 --- /dev/null +++ b/out/test/fixtures/existing/outputs/UseDocblock.php @@ -0,0 +1,15 @@ +name = $name; + } +} diff --git a/out/test/fixtures/existing/outputs/UseNullableDocblock.php b/out/test/fixtures/existing/outputs/UseNullableDocblock.php new file mode 100644 index 0000000..09fbfc9 --- /dev/null +++ b/out/test/fixtures/existing/outputs/UseNullableDocblock.php @@ -0,0 +1,15 @@ +name = $name; + } +} diff --git a/out/test/fixtures/existing/outputs/UseType.php b/out/test/fixtures/existing/outputs/UseType.php new file mode 100644 index 0000000..e20071c --- /dev/null +++ b/out/test/fixtures/existing/outputs/UseType.php @@ -0,0 +1,15 @@ +name = $name; + } +} diff --git a/test/fixtures/new/inputs/AddConstructorDocblock.php b/out/test/fixtures/new/inputs/AddConstructorDocblock.php similarity index 100% rename from test/fixtures/new/inputs/AddConstructorDocblock.php rename to out/test/fixtures/new/inputs/AddConstructorDocblock.php diff --git a/test/fixtures/new/inputs/ClassKeyword.php b/out/test/fixtures/new/inputs/ClassKeyword.php similarity index 100% rename from test/fixtures/new/inputs/ClassKeyword.php rename to out/test/fixtures/new/inputs/ClassKeyword.php diff --git a/test/fixtures/new/inputs/EmptyClass.php b/out/test/fixtures/new/inputs/EmptyClass.php similarity index 100% rename from test/fixtures/new/inputs/EmptyClass.php rename to out/test/fixtures/new/inputs/EmptyClass.php diff --git a/test/fixtures/new/inputs/EmptyConstructor.php b/out/test/fixtures/new/inputs/EmptyConstructor.php similarity index 100% rename from test/fixtures/new/inputs/EmptyConstructor.php rename to out/test/fixtures/new/inputs/EmptyConstructor.php diff --git a/out/test/fixtures/new/inputs/ExistingConstructor.php b/out/test/fixtures/new/inputs/ExistingConstructor.php new file mode 100644 index 0000000..2349ad4 --- /dev/null +++ b/out/test/fixtures/new/inputs/ExistingConstructor.php @@ -0,0 +1,14 @@ +rank = $rank; + } +} diff --git a/test/fixtures/new/inputs/ExistingProperty.php b/out/test/fixtures/new/inputs/ExistingProperty.php similarity index 100% rename from test/fixtures/new/inputs/ExistingProperty.php rename to out/test/fixtures/new/inputs/ExistingProperty.php diff --git a/test/fixtures/new/inputs/ExistingPropertyAssignation.php b/out/test/fixtures/new/inputs/ExistingPropertyAssignation.php similarity index 100% rename from test/fixtures/new/inputs/ExistingPropertyAssignation.php rename to out/test/fixtures/new/inputs/ExistingPropertyAssignation.php diff --git a/out/test/fixtures/new/inputs/ExistingPropertyInConstructor.php b/out/test/fixtures/new/inputs/ExistingPropertyInConstructor.php new file mode 100644 index 0000000..b66fc22 --- /dev/null +++ b/out/test/fixtures/new/inputs/ExistingPropertyInConstructor.php @@ -0,0 +1,11 @@ +rank = $rank; + } +} diff --git a/out/test/fixtures/new/inputs/MultipleClasses.php b/out/test/fixtures/new/inputs/MultipleClasses.php new file mode 100644 index 0000000..7da809f --- /dev/null +++ b/out/test/fixtures/new/inputs/MultipleClasses.php @@ -0,0 +1,14 @@ +name = $name; diff --git a/test/fixtures/new/outputs/ExistingPropertyAssignation.php b/out/test/fixtures/new/outputs/ExistingPropertyAssignation.php similarity index 100% rename from test/fixtures/new/outputs/ExistingPropertyAssignation.php rename to out/test/fixtures/new/outputs/ExistingPropertyAssignation.php diff --git a/test/fixtures/new/outputs/ExistingPropertyInConstructor.php b/out/test/fixtures/new/outputs/ExistingPropertyInConstructor.php similarity index 88% rename from test/fixtures/new/outputs/ExistingPropertyInConstructor.php rename to out/test/fixtures/new/outputs/ExistingPropertyInConstructor.php index f1e96b9..685bdba 100644 --- a/test/fixtures/new/outputs/ExistingPropertyInConstructor.php +++ b/out/test/fixtures/new/outputs/ExistingPropertyInConstructor.php @@ -5,6 +5,8 @@ class Jedi { + private $name; + public function __construct($name) { $this->name = $name; diff --git a/test/fixtures/new/outputs/MultilineConstructor.php b/out/test/fixtures/new/outputs/MultilineConstructor.php similarity index 100% rename from test/fixtures/new/outputs/MultilineConstructor.php rename to out/test/fixtures/new/outputs/MultilineConstructor.php diff --git a/out/test/fixtures/new/outputs/MultipleClasses.php b/out/test/fixtures/new/outputs/MultipleClasses.php new file mode 100644 index 0000000..c12cc11 --- /dev/null +++ b/out/test/fixtures/new/outputs/MultipleClasses.php @@ -0,0 +1,19 @@ +name = $name; + } +} + +class Sith +{ + +} diff --git a/out/test/fixtures/new/outputs/MultipleClassesCursorInFirst.php b/out/test/fixtures/new/outputs/MultipleClassesCursorInFirst.php new file mode 100644 index 0000000..c12cc11 --- /dev/null +++ b/out/test/fixtures/new/outputs/MultipleClassesCursorInFirst.php @@ -0,0 +1,19 @@ +name = $name; + } +} + +class Sith +{ + +} diff --git a/out/test/fixtures/new/outputs/MultipleClassesCursorInLast.php b/out/test/fixtures/new/outputs/MultipleClassesCursorInLast.php new file mode 100644 index 0000000..27a37e2 --- /dev/null +++ b/out/test/fixtures/new/outputs/MultipleClassesCursorInLast.php @@ -0,0 +1,19 @@ +name = $name; + } +} diff --git a/test/fixtures/new/outputs/TabIndentation.php b/out/test/fixtures/new/outputs/TabIndentation.php similarity index 90% rename from test/fixtures/new/outputs/TabIndentation.php rename to out/test/fixtures/new/outputs/TabIndentation.php index 6aad427..13f8238 100644 --- a/test/fixtures/new/outputs/TabIndentation.php +++ b/out/test/fixtures/new/outputs/TabIndentation.php @@ -7,7 +7,7 @@ class Jedi { private $rank; - private $name; + private $name; public function __construct($rank, $name) { diff --git a/test/fixtures/new/outputs/UpdateConstructorDocblock.php b/out/test/fixtures/new/outputs/UpdateConstructorDocblock.php similarity index 100% rename from test/fixtures/new/outputs/UpdateConstructorDocblock.php rename to out/test/fixtures/new/outputs/UpdateConstructorDocblock.php diff --git a/out/test/fixtures/remove/inputs/ConstructorDocblock.php b/out/test/fixtures/remove/inputs/ConstructorDocblock.php new file mode 100644 index 0000000..838e025 --- /dev/null +++ b/out/test/fixtures/remove/inputs/ConstructorDocblock.php @@ -0,0 +1,25 @@ +class = $class; + $this->name = $name; + $this->rank = $rank; + } +} diff --git a/out/test/fixtures/remove/inputs/ConstructorWithMultipleProperties.php b/out/test/fixtures/remove/inputs/ConstructorWithMultipleProperties.php new file mode 100644 index 0000000..74d99da --- /dev/null +++ b/out/test/fixtures/remove/inputs/ConstructorWithMultipleProperties.php @@ -0,0 +1,20 @@ +class = $class; + $this->name = $name; + $this->rank = $rank; + } +} diff --git a/out/test/fixtures/remove/inputs/ConstructorWithMultiplePropertiesCursorInArgument.php b/out/test/fixtures/remove/inputs/ConstructorWithMultiplePropertiesCursorInArgument.php new file mode 100644 index 0000000..74d99da --- /dev/null +++ b/out/test/fixtures/remove/inputs/ConstructorWithMultiplePropertiesCursorInArgument.php @@ -0,0 +1,20 @@ +class = $class; + $this->name = $name; + $this->rank = $rank; + } +} diff --git a/out/test/fixtures/remove/inputs/ConstructorWithMultiplePropertiesCursorInAssignment.php b/out/test/fixtures/remove/inputs/ConstructorWithMultiplePropertiesCursorInAssignment.php new file mode 100644 index 0000000..74d99da --- /dev/null +++ b/out/test/fixtures/remove/inputs/ConstructorWithMultiplePropertiesCursorInAssignment.php @@ -0,0 +1,20 @@ +class = $class; + $this->name = $name; + $this->rank = $rank; + } +} diff --git a/out/test/fixtures/remove/inputs/ConstructorWithMultiplePropertiesCursorInConstructorDocblock.php b/out/test/fixtures/remove/inputs/ConstructorWithMultiplePropertiesCursorInConstructorDocblock.php new file mode 100644 index 0000000..838e025 --- /dev/null +++ b/out/test/fixtures/remove/inputs/ConstructorWithMultiplePropertiesCursorInConstructorDocblock.php @@ -0,0 +1,25 @@ +class = $class; + $this->name = $name; + $this->rank = $rank; + } +} diff --git a/out/test/fixtures/remove/inputs/ConstructorWithMultiplePropertiesCursorInPropertyStatement.php b/out/test/fixtures/remove/inputs/ConstructorWithMultiplePropertiesCursorInPropertyStatement.php new file mode 100644 index 0000000..74d99da --- /dev/null +++ b/out/test/fixtures/remove/inputs/ConstructorWithMultiplePropertiesCursorInPropertyStatement.php @@ -0,0 +1,20 @@ +class = $class; + $this->name = $name; + $this->rank = $rank; + } +} diff --git a/out/test/fixtures/remove/inputs/ConstructorWithOneProperty.php b/out/test/fixtures/remove/inputs/ConstructorWithOneProperty.php new file mode 100644 index 0000000..6c281c0 --- /dev/null +++ b/out/test/fixtures/remove/inputs/ConstructorWithOneProperty.php @@ -0,0 +1,17 @@ +name = $name; + $this->initialized = true; + } +} diff --git a/out/test/fixtures/remove/inputs/ConstructorWithOtherArgument.php b/out/test/fixtures/remove/inputs/ConstructorWithOtherArgument.php new file mode 100644 index 0000000..0ab216a --- /dev/null +++ b/out/test/fixtures/remove/inputs/ConstructorWithOtherArgument.php @@ -0,0 +1,16 @@ +class = $class; + } +} diff --git a/out/test/fixtures/remove/inputs/ConstructorWithSingleProperty.php b/out/test/fixtures/remove/inputs/ConstructorWithSingleProperty.php new file mode 100644 index 0000000..685bdba --- /dev/null +++ b/out/test/fixtures/remove/inputs/ConstructorWithSingleProperty.php @@ -0,0 +1,14 @@ +name = $name; + } +} diff --git a/out/test/fixtures/remove/inputs/ConstructorWithSinglePropertyAndDocblock.php b/out/test/fixtures/remove/inputs/ConstructorWithSinglePropertyAndDocblock.php new file mode 100644 index 0000000..e3d2b34 --- /dev/null +++ b/out/test/fixtures/remove/inputs/ConstructorWithSinglePropertyAndDocblock.php @@ -0,0 +1,17 @@ +name = $name; + } +} diff --git a/out/test/fixtures/remove/inputs/EmptyConstructor.php b/out/test/fixtures/remove/inputs/EmptyConstructor.php new file mode 100644 index 0000000..a59fa4c --- /dev/null +++ b/out/test/fixtures/remove/inputs/EmptyConstructor.php @@ -0,0 +1,13 @@ +name = $name; + } +} diff --git a/out/test/fixtures/remove/inputs/TypedProperty.php b/out/test/fixtures/remove/inputs/TypedProperty.php new file mode 100644 index 0000000..ffff80a --- /dev/null +++ b/out/test/fixtures/remove/inputs/TypedProperty.php @@ -0,0 +1,14 @@ +name = $name; + } +} diff --git a/out/test/fixtures/remove/outputs/ConstructorDocblock.php b/out/test/fixtures/remove/outputs/ConstructorDocblock.php new file mode 100644 index 0000000..2798eaf --- /dev/null +++ b/out/test/fixtures/remove/outputs/ConstructorDocblock.php @@ -0,0 +1,21 @@ +class = $class; + $this->rank = $rank; + } +} diff --git a/out/test/fixtures/remove/outputs/ConstructorWithMultipleProperties.php b/out/test/fixtures/remove/outputs/ConstructorWithMultipleProperties.php new file mode 100644 index 0000000..6c3946b --- /dev/null +++ b/out/test/fixtures/remove/outputs/ConstructorWithMultipleProperties.php @@ -0,0 +1,17 @@ +class = $class; + $this->rank = $rank; + } +} diff --git a/out/test/fixtures/remove/outputs/ConstructorWithMultiplePropertiesCursorInArgument.php b/out/test/fixtures/remove/outputs/ConstructorWithMultiplePropertiesCursorInArgument.php new file mode 100644 index 0000000..eaa01a5 --- /dev/null +++ b/out/test/fixtures/remove/outputs/ConstructorWithMultiplePropertiesCursorInArgument.php @@ -0,0 +1,17 @@ +name = $name; + $this->rank = $rank; + } +} diff --git a/out/test/fixtures/remove/outputs/ConstructorWithMultiplePropertiesCursorInAssignment.php b/out/test/fixtures/remove/outputs/ConstructorWithMultiplePropertiesCursorInAssignment.php new file mode 100644 index 0000000..eaa01a5 --- /dev/null +++ b/out/test/fixtures/remove/outputs/ConstructorWithMultiplePropertiesCursorInAssignment.php @@ -0,0 +1,17 @@ +name = $name; + $this->rank = $rank; + } +} diff --git a/out/test/fixtures/remove/outputs/ConstructorWithMultiplePropertiesCursorInConstructorDocblock.php b/out/test/fixtures/remove/outputs/ConstructorWithMultiplePropertiesCursorInConstructorDocblock.php new file mode 100644 index 0000000..742107f --- /dev/null +++ b/out/test/fixtures/remove/outputs/ConstructorWithMultiplePropertiesCursorInConstructorDocblock.php @@ -0,0 +1,21 @@ +class = $class; + $this->name = $name; + } +} diff --git a/out/test/fixtures/remove/outputs/ConstructorWithMultiplePropertiesCursorInPropertyStatement.php b/out/test/fixtures/remove/outputs/ConstructorWithMultiplePropertiesCursorInPropertyStatement.php new file mode 100644 index 0000000..e361aa5 --- /dev/null +++ b/out/test/fixtures/remove/outputs/ConstructorWithMultiplePropertiesCursorInPropertyStatement.php @@ -0,0 +1,17 @@ +class = $class; + $this->name = $name; + } +} diff --git a/out/test/fixtures/remove/outputs/ConstructorWithOneProperty.php b/out/test/fixtures/remove/outputs/ConstructorWithOneProperty.php new file mode 100644 index 0000000..c5081c9 --- /dev/null +++ b/out/test/fixtures/remove/outputs/ConstructorWithOneProperty.php @@ -0,0 +1,14 @@ +initialized = true; + } +} diff --git a/out/test/fixtures/remove/outputs/ConstructorWithOtherArgument.php b/out/test/fixtures/remove/outputs/ConstructorWithOtherArgument.php new file mode 100644 index 0000000..6179c6b --- /dev/null +++ b/out/test/fixtures/remove/outputs/ConstructorWithOtherArgument.php @@ -0,0 +1,14 @@ +class = $class; + } +} diff --git a/out/test/fixtures/remove/outputs/ConstructorWithSingleProperty.php b/out/test/fixtures/remove/outputs/ConstructorWithSingleProperty.php new file mode 100644 index 0000000..7bdd7bf --- /dev/null +++ b/out/test/fixtures/remove/outputs/ConstructorWithSingleProperty.php @@ -0,0 +1,8 @@ +name = $name; + $this->rank = $rank; + } +} diff --git a/out/test/fixtures/rename/inputs/ConstructorWithMultipleProperties.php b/out/test/fixtures/rename/inputs/ConstructorWithMultipleProperties.php new file mode 100644 index 0000000..74d99da --- /dev/null +++ b/out/test/fixtures/rename/inputs/ConstructorWithMultipleProperties.php @@ -0,0 +1,20 @@ +class = $class; + $this->name = $name; + $this->rank = $rank; + } +} diff --git a/out/test/fixtures/rename/inputs/ConstructorWithMultiplePropertiesCursorInArgument.php b/out/test/fixtures/rename/inputs/ConstructorWithMultiplePropertiesCursorInArgument.php new file mode 100644 index 0000000..74d99da --- /dev/null +++ b/out/test/fixtures/rename/inputs/ConstructorWithMultiplePropertiesCursorInArgument.php @@ -0,0 +1,20 @@ +class = $class; + $this->name = $name; + $this->rank = $rank; + } +} diff --git a/out/test/fixtures/rename/inputs/ConstructorWithMultiplePropertiesCursorInAssignment.php b/out/test/fixtures/rename/inputs/ConstructorWithMultiplePropertiesCursorInAssignment.php new file mode 100644 index 0000000..74d99da --- /dev/null +++ b/out/test/fixtures/rename/inputs/ConstructorWithMultiplePropertiesCursorInAssignment.php @@ -0,0 +1,20 @@ +class = $class; + $this->name = $name; + $this->rank = $rank; + } +} diff --git a/out/test/fixtures/rename/inputs/ConstructorWithMultiplePropertiesCursorInConstructorDocblock.php b/out/test/fixtures/rename/inputs/ConstructorWithMultiplePropertiesCursorInConstructorDocblock.php new file mode 100644 index 0000000..e6292a1 --- /dev/null +++ b/out/test/fixtures/rename/inputs/ConstructorWithMultiplePropertiesCursorInConstructorDocblock.php @@ -0,0 +1,23 @@ +name = $name; + $this->rank = $rank; + } +} diff --git a/out/test/fixtures/rename/inputs/ConstructorWithMultiplePropertiesCursorInPropertyStatement.php b/out/test/fixtures/rename/inputs/ConstructorWithMultiplePropertiesCursorInPropertyStatement.php new file mode 100644 index 0000000..74d99da --- /dev/null +++ b/out/test/fixtures/rename/inputs/ConstructorWithMultiplePropertiesCursorInPropertyStatement.php @@ -0,0 +1,20 @@ +class = $class; + $this->name = $name; + $this->rank = $rank; + } +} diff --git a/out/test/fixtures/rename/inputs/ConstructorWithSingleProperty.php b/out/test/fixtures/rename/inputs/ConstructorWithSingleProperty.php new file mode 100644 index 0000000..685bdba --- /dev/null +++ b/out/test/fixtures/rename/inputs/ConstructorWithSingleProperty.php @@ -0,0 +1,14 @@ +name = $name; + } +} diff --git a/out/test/fixtures/rename/inputs/MultiplePropertyStatements.php b/out/test/fixtures/rename/inputs/MultiplePropertyStatements.php new file mode 100644 index 0000000..be7cebe --- /dev/null +++ b/out/test/fixtures/rename/inputs/MultiplePropertyStatements.php @@ -0,0 +1,14 @@ +name = $name; + } +} diff --git a/out/test/fixtures/rename/inputs/PropertyReferences.php b/out/test/fixtures/rename/inputs/PropertyReferences.php new file mode 100644 index 0000000..b4ee998 --- /dev/null +++ b/out/test/fixtures/rename/inputs/PropertyReferences.php @@ -0,0 +1,36 @@ +name = "Yoda"; + } + + public function getName(): string + { + return $this->name; + } + + public function getFormattedName(): string + { + $title = self::getTitle($this->name); + + return "{$title} {$this->name}"; + } + + public function setName(string $name) + { + $this->name = $name; + } + + public static function getTitle(string $name): string + { + return $name === "Yoda" ? "Master" : ""; + } +} diff --git a/out/test/fixtures/rename/outputs/ConstructorDocblock.php b/out/test/fixtures/rename/outputs/ConstructorDocblock.php new file mode 100644 index 0000000..764d02f --- /dev/null +++ b/out/test/fixtures/rename/outputs/ConstructorDocblock.php @@ -0,0 +1,23 @@ +newName = $newName; + $this->rank = $rank; + } +} diff --git a/out/test/fixtures/rename/outputs/ConstructorWithMultipleProperties.php b/out/test/fixtures/rename/outputs/ConstructorWithMultipleProperties.php new file mode 100644 index 0000000..e15b2f6 --- /dev/null +++ b/out/test/fixtures/rename/outputs/ConstructorWithMultipleProperties.php @@ -0,0 +1,20 @@ +class = $class; + $this->newName = $newName; + $this->rank = $rank; + } +} diff --git a/out/test/fixtures/rename/outputs/ConstructorWithMultiplePropertiesCursorInArgument.php b/out/test/fixtures/rename/outputs/ConstructorWithMultiplePropertiesCursorInArgument.php new file mode 100644 index 0000000..e15b2f6 --- /dev/null +++ b/out/test/fixtures/rename/outputs/ConstructorWithMultiplePropertiesCursorInArgument.php @@ -0,0 +1,20 @@ +class = $class; + $this->newName = $newName; + $this->rank = $rank; + } +} diff --git a/out/test/fixtures/rename/outputs/ConstructorWithMultiplePropertiesCursorInAssignment.php b/out/test/fixtures/rename/outputs/ConstructorWithMultiplePropertiesCursorInAssignment.php new file mode 100644 index 0000000..e15b2f6 --- /dev/null +++ b/out/test/fixtures/rename/outputs/ConstructorWithMultiplePropertiesCursorInAssignment.php @@ -0,0 +1,20 @@ +class = $class; + $this->newName = $newName; + $this->rank = $rank; + } +} diff --git a/out/test/fixtures/rename/outputs/ConstructorWithMultiplePropertiesCursorInConstructorDocblock.php b/out/test/fixtures/rename/outputs/ConstructorWithMultiplePropertiesCursorInConstructorDocblock.php new file mode 100644 index 0000000..764d02f --- /dev/null +++ b/out/test/fixtures/rename/outputs/ConstructorWithMultiplePropertiesCursorInConstructorDocblock.php @@ -0,0 +1,23 @@ +newName = $newName; + $this->rank = $rank; + } +} diff --git a/out/test/fixtures/rename/outputs/ConstructorWithMultiplePropertiesCursorInPropertyStatement.php b/out/test/fixtures/rename/outputs/ConstructorWithMultiplePropertiesCursorInPropertyStatement.php new file mode 100644 index 0000000..e15b2f6 --- /dev/null +++ b/out/test/fixtures/rename/outputs/ConstructorWithMultiplePropertiesCursorInPropertyStatement.php @@ -0,0 +1,20 @@ +class = $class; + $this->newName = $newName; + $this->rank = $rank; + } +} diff --git a/out/test/fixtures/rename/outputs/ConstructorWithSingleProperty.php b/out/test/fixtures/rename/outputs/ConstructorWithSingleProperty.php new file mode 100644 index 0000000..3b3ad90 --- /dev/null +++ b/out/test/fixtures/rename/outputs/ConstructorWithSingleProperty.php @@ -0,0 +1,14 @@ +newName = $newName; + } +} diff --git a/out/test/fixtures/rename/outputs/MultiplePropertyStatements.php b/out/test/fixtures/rename/outputs/MultiplePropertyStatements.php new file mode 100644 index 0000000..09062f9 --- /dev/null +++ b/out/test/fixtures/rename/outputs/MultiplePropertyStatements.php @@ -0,0 +1,14 @@ +newName = $newName; + } +} diff --git a/out/test/fixtures/rename/outputs/PropertyReferences.php b/out/test/fixtures/rename/outputs/PropertyReferences.php new file mode 100644 index 0000000..cc57a21 --- /dev/null +++ b/out/test/fixtures/rename/outputs/PropertyReferences.php @@ -0,0 +1,36 @@ +newName = "Yoda"; + } + + public function getName(): string + { + return $this->newName; + } + + public function getFormattedName(): string + { + $title = self::getTitle($this->newName); + + return "{$title} {$this->newName}"; + } + + public function setName(string $name) + { + $this->newName = $name; + } + + public static function getTitle(string $name): string + { + return $name === "Yoda" ? "Master" : ""; + } +} diff --git a/out/test/runTest.js b/out/test/runTest.js new file mode 100644 index 0000000..f068209 --- /dev/null +++ b/out/test/runTest.js @@ -0,0 +1,54 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const vscode_test_1 = require("vscode-test"); +function main() { + return __awaiter(this, void 0, void 0, function* () { + try { + // The folder containing the Extension Manifest package.json + // Passed to `--extensionDevelopmentPath` + const extensionDevelopmentPath = path.resolve(__dirname, '../../'); + // The path to test runner + // Passed to --extensionTestsPath + const extensionTestsPath = path.resolve(__dirname, './suite/index'); + const testUserDir = path.resolve(__dirname, './user'); + const vscodeCompatibilityString = require('../../package.json').engines.vscode; + const vscodeMinimumVersion = vscodeCompatibilityString.replace(/[^\d\.]/g, ''); + yield vscode_test_1.runTests({ + version: vscodeMinimumVersion, + extensionDevelopmentPath, + extensionTestsPath, + launchArgs: [ + `--user-data-dir=${testUserDir}`, + '--disable-extensions' + ], + extensionTestsEnv: { + 'VSCODE_VERSION': vscodeMinimumVersion, + } + }); + yield vscode_test_1.runTests({ + extensionDevelopmentPath, + extensionTestsPath, + launchArgs: [ + `--user-data-dir=${testUserDir}`, + '--disable-extensions' + ] + }); + } + catch (err) { + console.error('Failed to run tests'); + process.exit(1); + } + }); +} +main(); +//# sourceMappingURL=runTest.js.map \ No newline at end of file diff --git a/out/test/runTest.js.map b/out/test/runTest.js.map new file mode 100644 index 0000000..c8efd61 --- /dev/null +++ b/out/test/runTest.js.map @@ -0,0 +1 @@ +{"version":3,"file":"runTest.js","sourceRoot":"","sources":["../../src/test/runTest.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,6BAA6B;AAE7B,6CAAuC;AAEvC,SAAe,IAAI;;QAClB,IAAI;YACH,4DAA4D;YAC5D,yCAAyC;YACzC,MAAM,wBAAwB,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;YAEnE,0BAA0B;YAC1B,iCAAiC;YACjC,MAAM,kBAAkB,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;YAEpE,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;YAEtD,MAAM,yBAAyB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;YAC/E,MAAM,oBAAoB,GAAG,yBAAyB,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;YAE/E,MAAM,sBAAQ,CACb;gBACC,OAAO,EAAE,oBAAoB;gBAC7B,wBAAwB;gBACxB,kBAAkB;gBAClB,UAAU,EAAE;oBACX,mBAAmB,WAAW,EAAE;oBAChC,sBAAsB;iBACtB;gBACD,iBAAiB,EAAE;oBAClB,gBAAgB,EAAE,oBAAoB;iBACtC;aACD,CACD,CAAC;YAEF,MAAM,sBAAQ,CACb;gBACC,wBAAwB;gBACxB,kBAAkB;gBAClB,UAAU,EAAE;oBACX,mBAAmB,WAAW,EAAE;oBAChC,sBAAsB;iBACtB;aACD,CACD,CAAC;SACF;QAAC,OAAO,GAAG,EAAE;YACb,OAAO,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;YACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SAChB;IACF,CAAC;CAAA;AAED,IAAI,EAAE,CAAC"} \ No newline at end of file diff --git a/out/test/suite/RemoveProperty.test.js.map b/out/test/suite/RemoveProperty.test.js.map new file mode 100644 index 0000000..be1c8bc --- /dev/null +++ b/out/test/suite/RemoveProperty.test.js.map @@ -0,0 +1 @@ +{"version":3,"file":"RemoveProperty.test.js","sourceRoot":"","sources":["../../../src/test/suite/RemoveProperty.test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,iCAAiC;AACjC,6BAA6B;AAC7B,iCAAiC;AACjC,yBAAyB;AACzB,mCAA6E;AAE7E,MAAM,0BAA0B,GAAG,sBAAsB,CAAC;AAE1D,KAAK,CAAC,iBAAiB,EAAE;IACrB,KAAK,CAAC,GAAS,EAAE;QACb,MAAM,4BAAoB,EAAE,CAAC;IACjC,CAAC,CAAA,CAAC,CAAC;IAEH,QAAQ,CAAC,GAAS,EAAE;QAChB,MAAM,4BAAoB,EAAE,CAAC;IACjC,CAAC,CAAA,CAAC,CAAC;IAEH,IAAI,CAAC,4CAA4C,EAAE,GAAS,EAAE;QAC1D,MA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AACjF,CAAC"} \ No newline at end of file diff --git a/out/test/suite/addExistingProperty.test.js b/out/test/suite/addExistingProperty.test.js new file mode 100644 index 0000000..af6430b --- /dev/null +++ b/out/test/suite/addExistingProperty.test.js @@ -0,0 +1,80 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const vscode = require("vscode"); +const path = require("path"); +const assert = require("assert"); +const fs = require("fs"); +const utils_1 = require("./utils"); +const testFolderRelativeLocation = '/../fixtures/existing/'; +suite('Add Existing Property', function () { + setup(() => __awaiter(this, void 0, void 0, function* () { + yield utils_1.resetDefaultSettings(); + })); + teardown(() => __awaiter(this, void 0, void 0, function* () { + yield utils_1.resetDefaultSettings(); + })); + test('Should add an existing property and constructor in an empty class', () => __awaiter(this, void 0, void 0, function* () { + yield runFixture('EmptyClass.php', new vscode.Position(7, 0)); + })); + test('Should add an existing property to an empty constructor', () => __awaiter(this, void 0, void 0, function* () { + yield runFixture('EmptyConstructor.php', new vscode.Position(7, 0)); + })); + test('Should add an existing property to an existing constructor', () => __awaiter(this, void 0, void 0, function* () { + yield runFixture('ExistingConstructor.php', new vscode.Position(9, 0)); + })); + test('Should add an existing property using type from docblock', () => __awaiter(this, void 0, void 0, function* () { + yield runFixture('UseDocblock.php', new vscode.Position(8, 0)); + })); + test('Should add an existing property using its PHP7.4+ type', () => __awaiter(this, void 0, void 0, function* () { + yield runFixture('UseType.php', new vscode.Position(8, 0)); + })); + test('Should add a docblock with @param using type from property docblock', () => __awaiter(this, void 0, void 0, function* () { + yield vscode.workspace.getConfiguration('phpAddProperty').update('constructor.docblock.enable', true, true); + yield runFixture('ConstructorDocblockUsingDocblock.php', new vscode.Position(8, 0)); + })); + test('Should NOT add an extra space when adding property type and docblock type at the same type', () => __awaiter(this, void 0, void 0, function* () { + yield vscode.workspace.getConfiguration('phpAddProperty').update('constructor.docblock.enable', true, true); + yield vscode.workspace.getConfiguration('phpAddProperty').update('constructor.docblock.withParameter', true, true); + yield runFixture('DocblockTypeWithParameter.php', new vscode.Position(10, 22)); + })); + test('Should add an existing property with a nullable type', () => __awaiter(this, void 0, void 0, function* () { + yield vscode.workspace.getConfiguration('phpAddProperty').update('constructor.docblock.enable', true, true); + yield runFixture('NullableType.php', new vscode.Position(10, 0)); + })); + test('Should add a nullable property using type from property docblock', () => __awaiter(this, void 0, void 0, function* () { + yield runFixture('UseNullableDocblock.php', new vscode.Position(8, 0)); + })); +}); +function runFixture(fileName, cursorPosition) { + return __awaiter(this, void 0, void 0, function* () { + const uri = vscode.Uri.file(getInputFilePath(fileName)); + const document = yield vscode.workspace.openTextDocument(uri); + yield vscode.window.showTextDocument(document); + if (!vscode.window.activeTextEditor) { + return; + } + vscode.window.activeTextEditor.selections = [new vscode.Selection(cursorPosition, cursorPosition)]; + yield vscode.commands.executeCommand('phpAddProperty.append'); + const expectedText = fs.readFileSync(getOutputFilePath(fileName)).toString(); + yield utils_1.delay(utils_1.waitToAssertInSeconds, () => { + var _a; + assert.strictEqual((_a = vscode.window.activeTextEditor) === null || _a === void 0 ? void 0 : _a.document.getText(), expectedText); + }); + }); +} +function getInputFilePath(name) { + return path.join(__dirname + testFolderRelativeLocation + `inputs/${name}`); +} +function getOutputFilePath(name) { + return path.join(__dirname + testFolderRelativeLocation + `outputs/${name}`); +} +//# sourceMappingURL=addExistingProperty.test.js.map \ No newline at end of file diff --git a/out/test/suite/addExistingProperty.test.js.map b/out/test/suite/addExistingProperty.test.js.map new file mode 100644 index 0000000..251b2fc --- /dev/null +++ b/out/test/suite/addExistingProperty.test.js.map @@ -0,0 +1 @@ +{"version":3,"file":"addExistingProperty.test.js","sourceRoot":"","sources":["../../../src/test/suite/addExistingProperty.test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,iCAAiC;AACjC,6BAA6B;AAC7B,iCAAiC;AACjC,yBAAyB;AACzB,mCAA6E;AAE7E,MAAM,0BAA0B,GAAG,wBAAwB,CAAC;AAE5D,KAAK,CAAC,uBAAuB,EAAE;IAC3B,KAAK,CAAC,GAAS,EAAE;QACb,MAAM,4BAAoB,EAAE,CAAC;IACjC,CAAC,CAAA,CAAC,CAAC;IAEH,QAAQ,CAAC,GAAS,EAAE;QAChB,MAAM,4BAAoB,EAAE,CAAC;IACjC,CAAC,CAAA,CAAC,CAAC;IAEH,IAAI,CAAC,mEAAmE,EAAE,GAAS,EAAE;QACjF,MAAM,UAAU,CAAC,gBAAgB,EAAE,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAClE,CAAC,CAAA,CAAC,CAAC;IAEH,IAAI,CAAC,yDAAyD,EAAE,GAAS,EAAE;QACvE,MAAM,UAAU,CAAC,sBAAsB,EAAE,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACxE,CAAC,CAAA,CAAC,CAAC;IAEH,IAAI,CAAC,4DAA4D,EAAE,GAAS,EAAE;QAC1E,MAAM,UAAU,CAAC,yBAAyB,EAAE,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC3E,CAAC,CAAA,CAAC,CAAC;IAEH,IAAI,CAAC,0DAA0D,EAAE,GAAS,EAAE;QACxE,MAAM,UAAU,CAAC,iBAAiB,EAAE,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACnE,CAAC,CAAA,CAAC,CAAC;IAEH,IAAI,CAAC,wDAAwD,EAAE,GAAS,EAAE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C,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,0BAA0B,GAAG,WAAW,IAAI,EAAE,CAAC,CAAC;AACjF,CAAC"} \ No newline at end of file diff --git a/out/test/suite/addProperty.test.js b/out/test/suite/addProperty.test.js new file mode 100644 index 0000000..66e4c24 --- /dev/null +++ b/out/test/suite/addProperty.test.js @@ -0,0 +1,100 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const vscode = require("vscode"); +const path = require("path"); +const assert = require("assert"); +const fs = require("fs"); +const utils_1 = require("./utils"); +const testFolderRelativeLocation = '/../fixtures/new/'; +suite('Add Property', function () { + setup(() => __awaiter(this, void 0, void 0, function* () { + yield utils_1.resetDefaultSettings(); + })); + teardown(() => __awaiter(this, void 0, void 0, function* () { + yield utils_1.resetDefaultSettings(); + })); + test('Should insert property and constructor in an empty class', () => __awaiter(this, void 0, void 0, function* () { + yield runFixture('EmptyClass.php'); + })); + test('Should insert a new property and add it to an empty constructor', () => __awaiter(this, void 0, void 0, function* () { + yield runFixture('EmptyConstructor.php'); + })); + test('Should insert a new property and add it to an existing constructor', () => __awaiter(this, void 0, void 0, function* () { + yield runFixture('ExistingConstructor.php'); + })); + test('Should insert a new property in a multiline constructor', () => __awaiter(this, void 0, void 0, function* () { + yield runFixture('MultilineConstructor.php'); + })); + test('Should add a property to the constructor even if the property already exists', () => __awaiter(this, void 0, void 0, function* () { + yield runFixture('ExistingProperty.php'); + })); + test('Should NOT add a property to the constructor if it is already there', () => __awaiter(this, void 0, void 0, function* () { + yield runFixture('ExistingPropertyInConstructor.php'); + })); + test('Should NOT add the property assignation if it is already there', () => __awaiter(this, void 0, void 0, function* () { + yield runFixture('ExistingPropertyAssignation.php'); + })); + test('Should work with tab indentation', () => __awaiter(this, void 0, void 0, function* () { + yield runFixture('TabIndentation.php'); + })); + test('Should work when the class contains extra "class" keywords', () => __awaiter(this, void 0, void 0, function* () { + yield runFixture('ClassKeyword.php'); + })); + test('Should insert property in the first class if the file contains multiple', () => __awaiter(this, void 0, void 0, function* () { + yield runFixture('MultipleClasses.php'); + })); + test('Should insert property in the first class if the cursor is placed there', () => __awaiter(this, void 0, void 0, function* () { + yield runFixture('MultipleClassesCursorInFirst.php', new vscode.Position(8, 0)); + })); + test('Should insert property in the last class if the cursor is placed there', () => __awaiter(this, void 0, void 0, function* () { + yield runFixture('MultipleClassesCursorInLast.php', new vscode.Position(13, 0)); + })); + test('Should add a docblock with @param along with the constructor', () => __awaiter(this, void 0, void 0, function* () { + yield vscode.workspace.getConfiguration('phpAddProperty').update('constructor.docblock.enable', true, true); + yield runFixture('AddConstructorDocblock.php'); + })); + test('Should update the docblock adding the new @param', () => __awaiter(this, void 0, void 0, function* () { + yield vscode.workspace.getConfiguration('phpAddProperty').update('constructor.docblock.enable', true, true); + yield runFixture('UpdateConstructorDocblock.php'); + })); +}); +function runFixture(fileName, cursorPosition) { + return __awaiter(this, void 0, void 0, function* () { + const uri = vscode.Uri.file(getInputFilePath(fileName)); + const document = yield vscode.workspace.openTextDocument(uri); + yield vscode.window.showTextDocument(document); + if (!vscode.window.activeTextEditor) { + return; + } + if (cursorPosition === undefined) { + vscode.window.showInputBox = function (options, token) { + return Promise.resolve('name'); + }; + } + else { + vscode.window.activeTextEditor.selections = [new vscode.Selection(cursorPosition, cursorPosition)]; + } + yield vscode.commands.executeCommand('phpAddProperty.add'); + const expectedText = fs.readFileSync(getOutputFilePath(fileName)).toString(); + yield utils_1.delay(utils_1.waitToAssertInSeconds, () => { + var _a; + assert.strictEqual((_a = vscode.window.activeTextEditor) === null || _a === void 0 ? void 0 : _a.document.getText(), expectedText); + }); + }); +} +function getInputFilePath(name) { + return path.join(__dirname + testFolderRelativeLocation + `inputs/${name}`); +} +function getOutputFilePath(name) { + return path.join(__dirname + testFolderRelativeLocation + `outputs/${name}`); +} +//# sourceMappingURL=addProperty.test.js.map \ No newline at end of file diff --git a/out/test/suite/addProperty.test.js.map b/out/test/suite/addProperty.test.js.map new file mode 100644 index 0000000..1452e26 --- /dev/null +++ b/out/test/suite/addProperty.test.js.map @@ -0,0 +1 @@ +{"version":3,"file":"addProperty.test.js","sourceRoot":"","sources":["../../../src/test/suite/addProperty.test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,iCAAiC;AACjC,6BAA6B;AAC7B,iCAAiC;AACjC,yBAAyB;AACzB,mCAA6E;AAE7E,MAAM,0BAA0B,GAAG,mBAAmB,CAAC;AAEvD,KAAK,CAAC,cAAc,EAAE;IAClB,KAAK,CAAC,GAAS,EAAE;QACb,MAAM,4BAAoB,EAAE,CAAC;IACjC,CAAC,CAAA,CAAC,CAAC;IAEH,QAAQ,CAAC,GAAS,EAAE;QAChB,MAAM,4BAAoB,EAAE,CAAC;IACjC,CAAC,CAAA,CAAC,CAAC;IAEH,IAAI,CAAC,0DAA0D,EAAE,GAAS,EAAE;QACxE,MAAM,UAAU,CAAC,gBAAgB,CAAC,CAAC;IACvC,CAAC,CAAA,CAAC,CAAC;IAEH,IAAI,CAAC,iEAAiE,EAAE,GAAS,EAAE;QAC/E,MAAM,UAAU,CAAC,sBAAsB,CAAC,CAAC;IAC7C,CAAC,CAAA,CAAC,CAAC;IAEH,IAAI,CAAC,oEAAoE,EAAE,GAAS,EAAE;QAClF,MAAM,UAAU,CAAC,yBAAyB,CAAC,CAAC;IAChD,CAAC,CAAA,CAAC,CAAC;IAEH,IAAI,CAAC,yDAAyD,EAAE,GAAS,EAAE;QACvE,MAAM,UAAU,CAAC,0BAA0B,CAAC,CAAC;IACj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C,QAAQ,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;QAE7E,MAAM,aAAK,CAAC,6BAAqB,EAAE,GAAG,EAAE;;YACpC,MAAM,CAAC,WAAW,OAAC,MAAM,CAAC,MAAM,CAAC,gBAAgB,0CAAE,QAAQ,CAAC,OAAO,IAAI,YAAY,CAAC,CAAC;QACzF,CAAC,CAAC,CAAC;IACP,CAAC;CAAA;AAED,SAAS,gBAAgB,CAAC,IAAY;IAClC,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,0BAA0B,GAAG,UAAU,IAAI,EAAE,CAAC,CAAC;AAChF,CAAC;AAED,SAAS,iBAAiB,CAAC,IAAY;IACnC,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,0BAA0B,GAAG,WAAW,IAAI,EAAE,CAAC,CAAC;AACjF,CAAC"} \ No newline at end of file diff --git a/out/test/suite/breakConstructorIntoMultiline.test.js b/out/test/suite/breakConstructorIntoMultiline.test.js new file mode 100644 index 0000000..84f4ff9 --- /dev/null +++ b/out/test/suite/breakConstructorIntoMultiline.test.js @@ -0,0 +1,50 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const vscode = require("vscode"); +const path = require("path"); +const assert = require("assert"); +const fs = require("fs"); +const utils_1 = require("./utils"); +const testFolderRelativeLocation = '/../fixtures/breakConstructorIntoMultiline/'; +suite('Break Constructor Into Multilines', function () { + setup(() => __awaiter(this, void 0, void 0, function* () { + yield utils_1.resetDefaultSettings(); + })); + teardown(() => __awaiter(this, void 0, void 0, function* () { + yield utils_1.resetDefaultSettings(); + })); + test('Should break the constructor into multiline regardless of the settings', () => __awaiter(this, void 0, void 0, function* () { + yield vscode.workspace.getConfiguration('phpAddProperty').update('constructor.breakIntoMultilineIfLengthExceeded.enabled', false, true); + yield vscode.workspace.getConfiguration('phpAddProperty').update('constructor.breakIntoMultilineIfLengthExceeded.maxLineLength', 999, true); + yield runFixture('Constructor.php'); + })); +}); +function runFixture(fileName) { + return __awaiter(this, void 0, void 0, function* () { + const uri = vscode.Uri.file(getInputFilePath(fileName)); + const document = yield vscode.workspace.openTextDocument(uri); + yield vscode.window.showTextDocument(document); + yield vscode.commands.executeCommand('phpAddProperty.breakConstructorIntoMultiline'); + const expectedText = fs.readFileSync(getOutputFilePath(fileName)).toString(); + yield utils_1.delay(utils_1.waitToAssertInSeconds, () => { + var _a; + assert.strictEqual((_a = vscode.window.activeTextEditor) === null || _a === void 0 ? void 0 : _a.document.getText(), expectedText); + }); + }); +} +function getInputFilePath(name) { + return path.join(__dirname + testFolderRelativeLocation + `inputs/${name}`); +} +function getOutputFilePath(name) { + return path.join(__dirname + testFolderRelativeLocation + `outputs/${name}`); +} +//# sourceMappingURL=breakConstructorIntoMultiline.test.js.map \ No newline at end of file diff --git a/out/test/suite/breakConstructorIntoMultiline.test.js.map b/out/test/suite/breakConstructorIntoMultiline.test.js.map new file mode 100644 index 0000000..d137f27 --- /dev/null +++ b/out/test/suite/breakConstructorIntoMultiline.test.js.map @@ -0,0 +1 @@ +{"version":3,"file":"breakConstructorIntoMultiline.test.js","sourceRoot":"","sources":["../../../src/test/suite/breakConstructorIntoMultiline.test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,iCAAiC;AACjC,6BAA6B;AAC7B,iCAAiC;AACjC,yBAAyB;AACzB,mCAA6E;AAE7E,MAAM,0BAA0B,GAAG,6CAA6C,CAAC;AAEjF,KAAK,CAAC,mCAAmC,EAAE;IACvC,KAAK,CAAC,GAAS,EAA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AAED,SAAS,gBAAgB,CAAC,IAAY;IAClC,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,0BAA0B,GAAG,UAAU,IAAI,EAAE,CAAC,CAAC;AAChF,CAAC;AAED,SAAS,iBAAiB,CAAC,IAAY;IACnC,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,0BAA0B,GAAG,WAAW,IAAI,EAAE,CAAC,CAAC;AACjF,CAAC"} \ No newline at end of file diff --git a/out/test/suite/changePropertyType.test.js b/out/test/suite/changePropertyType.test.js new file mode 100644 index 0000000..68d64b6 --- /dev/null +++ b/out/test/suite/changePropertyType.test.js @@ -0,0 +1,86 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const vscode = require("vscode"); +const path = require("path"); +const assert = require("assert"); +const fs = require("fs"); +const utils_1 = require("./utils"); +const testFolderRelativeLocation = '/../fixtures/changePropertyType/'; +suite('Change Property Type', function () { + setup(() => __awaiter(this, void 0, void 0, function* () { + yield utils_1.resetDefaultSettings(); + })); + teardown(() => __awaiter(this, void 0, void 0, function* () { + yield utils_1.resetDefaultSettings(); + })); + test('Should change a property type by name', () => __awaiter(this, void 0, void 0, function* () { + yield runFixture('ConstructorWithMultipleProperties.php'); + })); + test('Should change the property statement type if already exists', () => __awaiter(this, void 0, void 0, function* () { + yield runFixture('TypedPropertyStatement.php'); + })); + test('Should change the property statement type if typed properties is enabled', () => __awaiter(this, void 0, void 0, function* () { + yield vscode.workspace.getConfiguration('phpAddProperty').update('property.types', true, true); + yield runFixture('PropertyWithoutType.php'); + })); + test('Should change property statement docblock type', () => __awaiter(this, void 0, void 0, function* () { + yield runFixture('PropertyStatementDocblock.php'); + })); + test('Should NOT change other properties statement docblock type', () => __awaiter(this, void 0, void 0, function* () { + yield runFixture('OtherPropertiesStatementDocblock.php'); + })); + test('Should change property type in constructor docblock', () => __awaiter(this, void 0, void 0, function* () { + yield runFixture('ConstructorDocblock.php'); + })); + test('Should rename a property when the cursor is placed in its constructor docblock param', () => __awaiter(this, void 0, void 0, function* () { + yield runFixture('ConstructorWithMultiplePropertiesCursorInConstructorDocblock.php', new vscode.Position(15, 17)); + })); +}); +function runFixture(fileName, cursorPosition) { + return __awaiter(this, void 0, void 0, function* () { + const uri = vscode.Uri.file(getInputFilePath(fileName)); + const document = yield vscode.workspace.openTextDocument(uri); + yield vscode.window.showTextDocument(document); + if (!vscode.window.activeTextEditor) { + return; + } + if (cursorPosition === undefined) { + let first = true; + vscode.window.showInputBox = function (options, token) { + if (first === true) { + first = false; + return Promise.resolve('name'); + } + return Promise.resolve('Name'); + }; + } + else { + vscode.window.activeTextEditor.selections = [new vscode.Selection(cursorPosition, cursorPosition)]; + vscode.window.showInputBox = function (options, token) { + return Promise.resolve('Name'); + }; + } + yield vscode.commands.executeCommand('phpAddProperty.changeType'); + const expectedText = fs.readFileSync(getOutputFilePath(fileName)).toString(); + yield utils_1.delay(utils_1.waitToAssertInSeconds, () => { + var _a; + assert.strictEqual((_a = vscode.window.activeTextEditor) === null || _a === void 0 ? void 0 : _a.document.getText(), expectedText); + }); + }); +} +function getInputFilePath(name) { + return path.join(__dirname + testFolderRelativeLocation + `inputs/${name}`); +} +function getOutputFilePath(name) { + return path.join(__dirname + testFolderRelativeLocation + `outputs/${name}`); +} +//# sourceMappingURL=changePropertyType.test.js.map \ No newline at end of file diff --git a/out/test/suite/changePropertyType.test.js.map b/out/test/suite/changePropertyType.test.js.map new file mode 100644 index 0000000..c6135a9 --- /dev/null +++ b/out/test/suite/changePropertyType.test.js.map @@ -0,0 +1 @@ +{"version":3,"file":"changePropertyType.test.js","sourceRoot":"","sources":["../../../src/test/suite/changePropertyType.test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,iCAAiC;AACjC,6BAA6B;AAC7B,iCAAiC;AACjC,yBAAyB;AACzB,mCAA6E;AAE7E,MAAM,0BAA0B,GAAG,kCAAkC,CAAC;AAEtE,KAAK,CAAC,sBAAsB,EAAE;IAC1B,KAAK,CAAC,GAAS,EAAE;QACb,MAAM,4BAAoB,EAAE,CAAC;IACjC,CAAC,CAAA,CAAC,CAAC;IAEH,QAAQ,CAAC,GAAS,EAAE;QAChB,MAAM,4BAAoB,EAAE,CAAC;IACjC,CAAC,CAAA,CAAC,CAAC;IAEH,IAAI,CAAC,uCAAuC,EAAE,GAAS,EAAE;QACrD,MAAM,UAAU,CAAC,uCAAuC,CAAC,CAAC;IAC9D,CAAC,CAAA,CAAC,CAAC;IAEH,IAAI,CAAC,6DAA6D,EAAE,GAAS,EAAE;QAC3E,MAAM,UAAU,CAAC,4BAA4B,CAAC,CAAC;IACnD,CAAC,CAAA,CAAC,CAAC;IAEH,IAAI,CAAC,0EAA0E,EAAE,GAAS,EAAE;QACxF,MAAM,MAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,CAAC,MAAM,CAAC,gBAAgB,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAC/F,MAAM,UAAU,CAAC,yBAAyB,CAAC,CAAC;IAChD,CAAC,CAAA,CAAC,CAAC;IAEH,IAAI,CAAC,gDAAgD,EAAE,GAAS,EAAE;QAC9D,MAAM,UAAU,CAAC,+BAA+B,CAAC,CAAC;IACtD,CAAC,CAAA,CAAC,CAAC;IAEH,IAAI,CAAC,4DAA4D,EAAE,GAAS,EAAE;QAC1E,MAAM,UAAU,CAAC,sCAAsC,CAAC,CAAC;IAC7D,CAAC,CAAA,CAAC,CAAC;IAEH,IAAI,CAAC,qDAAqD,EAAE,GAAS,E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OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YACnC,CAAC,CAAC;SACL;QAED,MAAM,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,2BAA2B,CAAC,CAAC;QAElE,MAAM,YAAY,GAAG,EAAE,CAAC,YAAY,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;QAE7E,MAAM,aAAK,CAAC,6BAAqB,EAAE,GAAG,EAAE;;YACpC,MAAM,CAAC,WAAW,OAAC,MAAM,CAAC,MAAM,CAAC,gBAAgB,0CAAE,QAAQ,CAAC,OAAO,IAAI,YAAY,CAAC,CAAC;QACzF,CAAC,CAAC,CAAC;IACP,CAAC;CAAA;AAED,SAAS,gBAAgB,CAAC,IAAY;IAClC,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,0BAA0B,GAAG,UAAU,IAAI,EAAE,CAAC,CAAC;AAChF,CAAC;AAED,SAAS,iBAAiB,CAAC,IAAY;IACnC,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,0BAA0B,GAAG,WAAW,IAAI,EAAE,CAAC,CAAC;AACjF,CAAC"} \ No newline at end of file diff --git a/out/test/suite/customizations.test.js b/out/test/suite/customizations.test.js new file mode 100644 index 0000000..1574d93 --- /dev/null +++ b/out/test/suite/customizations.test.js @@ -0,0 +1,74 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const vscode = require("vscode"); +const path = require("path"); +const assert = require("assert"); +const fs = require("fs"); +const utils_1 = require("./utils"); +const testFolderRelativeLocation = '/../fixtures/customizations/'; +suite('Customizations', function () { + setup(() => __awaiter(this, void 0, void 0, function* () { + yield utils_1.resetDefaultSettings(); + })); + teardown(() => __awaiter(this, void 0, void 0, function* () { + yield utils_1.resetDefaultSettings(); + })); + test('Should use the specified property default visibility', () => __awaiter(this, void 0, void 0, function* () { + yield vscode.workspace.getConfiguration('phpAddProperty').update('property.visibility.default', 'public', true); + yield runFixture('PropertyDefaultVisibility.php'); + })); + test('Should add the docblock', () => __awaiter(this, void 0, void 0, function* () { + yield vscode.workspace.getConfiguration('phpAddProperty').update('property.docblock.add', true, true); + yield runFixture('PropertyAddDocblock.php'); + })); + test('Should add a multiline docblock', () => __awaiter(this, void 0, void 0, function* () { + yield vscode.workspace.getConfiguration('phpAddProperty').update('property.docblock.add', true, true); + yield vscode.workspace.getConfiguration('phpAddProperty').update('property.docblock.multiline', true, true); + yield runFixture('PropertyMultilineDocblock.php'); + })); + test('Should use the specified constructor default visibility', () => __awaiter(this, void 0, void 0, function* () { + yield vscode.workspace.getConfiguration('phpAddProperty').update('constructor.visibility.default', 'private', true); + yield runFixture('ConstructorDefaultVisibility.php'); + })); + test('Should break constructor into multiple lines', () => __awaiter(this, void 0, void 0, function* () { + yield vscode.workspace.getConfiguration('phpAddProperty').update('constructor.breakIntoMultilineIfLengthExceeded.enabled', true, true); + yield runFixture('ConstructorBreakIntoMultiline.php'); + })); + test('Should break constructor into multiple lines at a specified length', () => __awaiter(this, void 0, void 0, function* () { + yield vscode.workspace.getConfiguration('phpAddProperty').update('constructor.breakIntoMultilineIfLengthExceeded.enabled', true, true); + yield vscode.workspace.getConfiguration('phpAddProperty').update('constructor.breakIntoMultilineIfLengthExceeded.maxLineLength', 40, true); + yield runFixture('ConstructorBreakIntoMultilineLength.php'); + })); +}); +function runFixture(fileName) { + return __awaiter(this, void 0, void 0, function* () { + vscode.window.showInputBox = function (options, token) { + return Promise.resolve('name'); + }; + const uri = vscode.Uri.file(getInputFilePath(fileName)); + const document = yield vscode.workspace.openTextDocument(uri); + yield vscode.window.showTextDocument(document); + yield vscode.commands.executeCommand('phpAddProperty.add'); + const expectedText = fs.readFileSync(getOutputFilePath(fileName)).toString(); + yield utils_1.delay(utils_1.waitToAssertInSeconds, () => { + var _a; + assert.strictEqual((_a = vscode.window.activeTextEditor) === null || _a === void 0 ? void 0 : _a.document.getText(), expectedText); + }); + }); +} +function getInputFilePath(name) { + return path.join(__dirname + testFolderRelativeLocation + `inputs/${name}`); +} +function getOutputFilePath(name) { + return path.join(__dirname + testFolderRelativeLocation + `outputs/${name}`); +} +//# sourceMappingURL=customizations.test.js.map \ No newline at end of file diff --git a/out/test/suite/customizations.test.js.map b/out/test/suite/customizations.test.js.map new file mode 100644 index 0000000..da880f4 --- /dev/null +++ b/out/test/suite/customizations.test.js.map @@ -0,0 +1 @@ +{"version":3,"file":"customizations.test.js","sourceRoot":"","sources":["../../../src/test/suite/customizations.test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,iCAAiC;AACjC,6BAA6B;AAC7B,iCAAiC;AACjC,yBAAyB;AACzB,mCAA6E;AAE7E,MAAM,0BAA0B,GAAG,8BAA8B,CAAC;AAElE,KAAK,CAAC,gBAAgB,EAAE;IACpB,KAAK,CAAC,GAAS,EAAE;QACb,MAAM,4BAAoB,EAAE,CAAC;IACjC,CAAC,CAAA,CAAC,CAAC;IAEH,QAAQ,CAAC,GAAS,EAAE;QAChB,MAAM,4BAAoB,EAAE,CAAC;IACjC,CAAC,CAAA,CAAC,CAAC;IAEH,IAAI,CAAC,sDAAsD,EAAE,GAAS,EAAE;QACpE,MAAM,MAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,CAAC,MAAM,CAAC,6BAA6B,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;QAChH,MAAM,UAAU,CAAC,+BAA+B,CAAC,CAAC;IACtD,CAAC,CAAA,CAAC,CAAC;IAEH,IAAI,CAAC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AS,iBAAiB,CAAC,IAAY;IACnC,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,0BAA0B,GAAG,WAAW,IAAI,EAAE,CAAC,CAAC;AACjF,CAAC"} \ No newline at end of file diff --git a/out/test/suite/index.js b/out/test/suite/index.js new file mode 100644 index 0000000..d298297 --- /dev/null +++ b/out/test/suite/index.js @@ -0,0 +1,42 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const Mocha = require("mocha"); +const glob = require("glob"); +function run() { + // Create the mocha test + const mocha = new Mocha({ + ui: 'tdd', + color: true + }); + const testsRoot = path.resolve(__dirname, '..'); + return new Promise((c, e) => { + glob('**/**.test.js', { cwd: testsRoot }, (err, files) => { + if (err) { + return e(err); + } + // Add files to the test suite + files.forEach(f => mocha.addFile(path.resolve(testsRoot, f))); + try { + // Run the mocha test + mocha.run(failures => { + if (process.env.VSCODE_VERSION === '1.31.0') { + process.exit(failures > 0 ? 1 : 0); + } + if (failures > 0) { + e(new Error(`${failures} tests failed.`)); + } + else { + c(); + } + }); + } + catch (err) { + console.error(err); + e(err); + } + }); + }); +} +exports.run = run; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/out/test/suite/index.js.map b/out/test/suite/index.js.map new file mode 100644 index 0000000..0673f51 --- /dev/null +++ b/out/test/suite/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/test/suite/index.ts"],"names":[],"mappings":";;AAAA,6BAA6B;AAC7B,+BAA+B;AAC/B,6BAA6B;AAE7B,SAAgB,GAAG;IAClB,wBAAwB;IACxB,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC;QACvB,EAAE,EAAE,KAAK;QACT,KAAK,EAAE,IAAI;KACX,CAAC,CAAC;IAEH,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IAEhD,OAAO,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QAC3B,IAAI,CAAC,eAAe,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;YACxD,IAAI,GAAG,EAAE;gBACR,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC;aACd;YAED,8BAA8B;YAC9B,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;YAE9D,IAAI;gBACH,qBAAqB;gBACrB,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;oBACpB,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc,KAAK,QAAQ,EAAE;wBAC5C,OAAO,CAAC,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;qBACnC;oBAED,IAAI,QAAQ,GAAG,CAAC,EAAE;wBACjB,CAAC,CAAC,IAAI,KAAK,CAAC,GAAG,QAAQ,gBAAgB,CAAC,CAAC,CAAC;qBAC1C;yBAAM;wBACN,CAAC,EAAE,CAAC;qBACJ;gBACF,CAAC,CAAC,CAAC;aACH;YAAC,OAAO,GAAG,EAAE;gBACb,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACnB,CAAC,CAAC,GAAG,CAAC,CAAC;aACP;QACF,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC;AArCD,kBAqCC"} \ No newline at end of file diff --git a/out/test/suite/removeProperty.test.js b/out/test/suite/removeProperty.test.js new file mode 100644 index 0000000..2a6c931 --- /dev/null +++ b/out/test/suite/removeProperty.test.js @@ -0,0 +1,95 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const vscode = require("vscode"); +const path = require("path"); +const assert = require("assert"); +const fs = require("fs"); +const utils_1 = require("./utils"); +const testFolderRelativeLocation = '/../fixtures/remove/'; +suite('Remove Property', function () { + setup(() => __awaiter(this, void 0, void 0, function* () { + yield utils_1.resetDefaultSettings(); + })); + teardown(() => __awaiter(this, void 0, void 0, function* () { + yield utils_1.resetDefaultSettings(); + })); + test('Should remove an existing property by name', () => __awaiter(this, void 0, void 0, function* () { + yield runFixture('ConstructorWithMultipleProperties.php'); + })); + test('Should remove the constructor method when the body is empty', () => __awaiter(this, void 0, void 0, function* () { + yield runFixture('EmptyConstructor.php'); + })); + test('Should remove the constructor method when the body is empty after removing the last property', () => __awaiter(this, void 0, void 0, function* () { + yield runFixture('ConstructorWithSingleProperty.php'); + })); + test('Should NOT remove the constructor method when the body is NOT empty after removing the last property', () => __awaiter(this, void 0, void 0, function* () { + yield runFixture('ConstructorWithOneProperty.php'); + })); + test('Should NOT remove the constructor argument when the property name does not match', () => __awaiter(this, void 0, void 0, function* () { + yield runFixture('ConstructorWithOtherArgument.php'); + })); + test('Should remove the constructor docblock along with the constructor', () => __awaiter(this, void 0, void 0, function* () { + yield runFixture('ConstructorWithSinglePropertyAndDocblock.php'); + })); + test('Should remove typed properties', () => __awaiter(this, void 0, void 0, function* () { + yield runFixture('TypedProperty.php'); + })); + test('Should remove the property docblock', () => __awaiter(this, void 0, void 0, function* () { + yield runFixture('PropertyWithDocblock.php'); + })); + test('Should remove the property from the constructor docblock', () => __awaiter(this, void 0, void 0, function* () { + yield runFixture('ConstructorDocblock.php'); + })); + test('Should remove a property when the cursor is placed in its statement', () => __awaiter(this, void 0, void 0, function* () { + yield runFixture('ConstructorWithMultiplePropertiesCursorInPropertyStatement.php', new vscode.Position(11, 13)); + })); + test('Should remove a property when the cursor is placed in its constructor argument', () => __awaiter(this, void 0, void 0, function* () { + yield runFixture('ConstructorWithMultiplePropertiesCursorInArgument.php', new vscode.Position(13, 35)); + })); + test('Should remove a property when the cursor is placed in its assignment', () => __awaiter(this, void 0, void 0, function* () { + yield runFixture('ConstructorWithMultiplePropertiesCursorInAssignment.php', new vscode.Position(15, 18)); + })); + test('Should remove a property when the cursor is placed in its constructor docblock', () => __awaiter(this, void 0, void 0, function* () { + yield runFixture('ConstructorWithMultiplePropertiesCursorInConstructorDocblock.php', new vscode.Position(16, 24)); + })); +}); +function runFixture(fileName, cursorPosition) { + return __awaiter(this, void 0, void 0, function* () { + const uri = vscode.Uri.file(getInputFilePath(fileName)); + const document = yield vscode.workspace.openTextDocument(uri); + yield vscode.window.showTextDocument(document); + if (!vscode.window.activeTextEditor) { + return; + } + if (cursorPosition === undefined) { + vscode.window.showInputBox = function (options, token) { + return Promise.resolve('name'); + }; + } + else { + vscode.window.activeTextEditor.selections = [new vscode.Selection(cursorPosition, cursorPosition)]; + } + yield vscode.commands.executeCommand('phpAddProperty.remove'); + const expectedText = fs.readFileSync(getOutputFilePath(fileName)).toString(); + yield utils_1.delay(utils_1.waitToAssertInSeconds, () => { + var _a; + assert.strictEqual((_a = vscode.window.activeTextEditor) === null || _a === void 0 ? void 0 : _a.document.getText(), expectedText); + }); + }); +} +function getInputFilePath(name) { + return path.join(__dirname + testFolderRelativeLocation + `inputs/${name}`); +} +function getOutputFilePath(name) { + return path.join(__dirname + testFolderRelativeLocation + `outputs/${name}`); +} +//# sourceMappingURL=removeProperty.test.js.map \ No newline at end of file diff --git a/out/test/suite/removeProperty.test.js.map b/out/test/suite/removeProperty.test.js.map new file mode 100644 index 0000000..6ac645a --- /dev/null +++ b/out/test/suite/removeProperty.test.js.map @@ -0,0 +1 @@ +{"version":3,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,GAAG,CAAC,CAAC;QAC9D,MAAM,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QAE/C,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE;YACjC,OAAO;SACV;QAED,IAAI,cAAc,KAAK,SAAS,EAAE;YAC9B,MAAM,CAAC,MAAM,CAAC,YAAY,GAAG,UACzB,OAA4C,EAC5C,KAA4C;gBAE5C,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YACnC,CAAC,CAAC;SACL;aAAM;YACH,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,UAAU,GAAG,CAAC,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC,CAAC;SACtG;QAED,MAAM,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,uBAAuB,CAAC,CAAC;QAE9D,MAAM,YAAY,GAAG,EAAE,CAAC,YAAY,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;QAE7E,MAAM,aAAK,CAAC,6BAAqB,EAAE,GAAG,EAAE;;YACpC,MAAM,CAAC,WAAW,OAAC,MAAM,CAAC,MAAM,CAAC,gBAAgB,0CAAE,QAAQ,CAAC,OAAO,IAAI,YAAY,CAAC,CAAC;QACzF,CAAC,CAAC,CAAC;IACP,CAAC;CAAA;AAED,SAAS,gBAAgB,CAAC,IAAY;IAClC,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,0BAA0B,GAAG,UAAU,IAAI,EAAE,CAAC,CAAC;AAChF,CAAC;AAED,SAAS,iBAAiB,CAAC,IAAY;IACnC,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,0BAA0B,GAAG,WAAW,IAAI,EAAE,CAAC,CAAC;AACjF,CAAC"} \ No newline at end of file diff --git a/out/test/suite/renameProperty.test.js b/out/test/suite/renameProperty.test.js new file mode 100644 index 0000000..c380863 --- /dev/null +++ b/out/test/suite/renameProperty.test.js @@ -0,0 +1,91 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const vscode = require("vscode"); +const path = require("path"); +const assert = require("assert"); +const fs = require("fs"); +const utils_1 = require("./utils"); +const testFolderRelativeLocation = '/../fixtures/rename/'; +suite('Rename Property', function () { + setup(() => __awaiter(this, void 0, void 0, function* () { + yield utils_1.resetDefaultSettings(); + })); + teardown(() => __awaiter(this, void 0, void 0, function* () { + yield utils_1.resetDefaultSettings(); + })); + test('Should rename a property by name', () => __awaiter(this, void 0, void 0, function* () { + yield runFixture('ConstructorWithMultipleProperties.php'); + })); + test('Should rename a single property', () => __awaiter(this, void 0, void 0, function* () { + yield runFixture('ConstructorWithSingleProperty.php'); + })); + test('Should rename a property when the cursor is placed in its statement', () => __awaiter(this, void 0, void 0, function* () { + yield runFixture('ConstructorWithMultiplePropertiesCursorInPropertyStatement.php', new vscode.Position(9, 13)); + })); + test('Should rename a property when the cursor is placed in its constructor argument', () => __awaiter(this, void 0, void 0, function* () { + yield runFixture('ConstructorWithMultiplePropertiesCursorInArgument.php', new vscode.Position(13, 50)); + })); + test('Should rename a property when the cursor is placed in its assignment', () => __awaiter(this, void 0, void 0, function* () { + yield runFixture('ConstructorWithMultiplePropertiesCursorInAssignment.php', new vscode.Position(16, 18)); + })); + test('Should rename a property when the cursor is placed in its constructor docblock param', () => __awaiter(this, void 0, void 0, function* () { + yield runFixture('ConstructorWithMultiplePropertiesCursorInConstructorDocblock.php', new vscode.Position(14, 10)); + })); + test('Should rename all property references', () => __awaiter(this, void 0, void 0, function* () { + yield runFixture('PropertyReferences.php'); + })); + test('Should rename only one property when there are more than one properties per statement', () => __awaiter(this, void 0, void 0, function* () { + yield runFixture('MultiplePropertyStatements.php'); + })); + test('Should rename constructor param docblock', () => __awaiter(this, void 0, void 0, function* () { + yield runFixture('ConstructorDocblock.php'); + })); +}); +function runFixture(fileName, cursorPosition) { + return __awaiter(this, void 0, void 0, function* () { + const uri = vscode.Uri.file(getInputFilePath(fileName)); + const document = yield vscode.workspace.openTextDocument(uri); + yield vscode.window.showTextDocument(document); + if (!vscode.window.activeTextEditor) { + return; + } + if (cursorPosition === undefined) { + let first = true; + vscode.window.showInputBox = function (options, token) { + if (first === true) { + first = false; + return Promise.resolve('name'); + } + return Promise.resolve('newName'); + }; + } + else { + vscode.window.activeTextEditor.selections = [new vscode.Selection(cursorPosition, cursorPosition)]; + vscode.window.showInputBox = function (options, token) { + return Promise.resolve('newName'); + }; + } + yield vscode.commands.executeCommand('phpAddProperty.rename'); + const expectedText = fs.readFileSync(getOutputFilePath(fileName)).toString(); + yield utils_1.delay(utils_1.waitToAssertInSeconds, () => { + var _a; + assert.strictEqual((_a = vscode.window.activeTextEditor) === null || _a === void 0 ? void 0 : _a.document.getText(), expectedText); + }); + }); +} +function getInputFilePath(name) { + return path.join(__dirname + testFolderRelativeLocation + `inputs/${name}`); +} +function getOutputFilePath(name) { + return path.join(__dirname + testFolderRelativeLocation + `outputs/${name}`); +} +//# sourceMappingURL=renameProperty.test.js.map \ No newline at end of file diff --git a/out/test/suite/renameProperty.test.js.map b/out/test/suite/renameProperty.test.js.map new file mode 100644 index 0000000..96aefe6 --- /dev/null +++ b/out/test/suite/renameProperty.test.js.map @@ -0,0 +1 @@ +{"version":3,"file":"renameProperty.test.js","sourceRoot":"","sources":["../../../src/test/suite/renameProperty.test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,iCAAiC;AACjC,6BAA6B;AAC7B,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AAS,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC,CAAC;YAEnG,MAAM,CAAC,MAAM,CAAC,YAAY,GAAG,UACzB,OAA4C,EAC5C,KAA4C;gBAE5C,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;YACtC,CAAC,CAAC;SACL;QAED,MAAM,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,uBAAuB,CAAC,CAAC;QAE9D,MAAM,YAAY,GAAG,EAAE,CAAC,YAAY,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;QAE7E,MAAM,aAAK,CAAC,6BAAqB,EAAE,GAAG,EAAE;;YACpC,MAAM,CAAC,WAAW,OAAC,MAAM,CAAC,MAAM,CAAC,gBAAgB,0CAAE,QAAQ,CAAC,OAAO,IAAI,YAAY,CAAC,CAAC;QACzF,CAAC,CAAC,CAAC;IACP,CAAC;CAAA;AAED,SAAS,gBAAgB,CAAC,IAAY;IAClC,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,0BAA0B,GAAG,UAAU,IAAI,EAAE,CAAC,CAAC;AAChF,CAAC;AAED,SAAS,iBAAiB,CAAC,IAAY;IACnC,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,0BAA0B,GAAG,WAAW,IAAI,EAAE,CAAC,CAAC;AACjF,CAAC"} \ No newline at end of file diff --git a/out/test/suite/utils.js b/out/test/suite/utils.js new file mode 100644 index 0000000..f4a6ada --- /dev/null +++ b/out/test/suite/utils.js @@ -0,0 +1,56 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const vscode = require("vscode"); +exports.waitToAssertInSeconds = 15; +function delay(seconds, callback) { + return new Promise(resolve => { + setTimeout(() => { + callback(); + resolve(); + }, seconds * exports.waitToAssertInSeconds); + }); +} +exports.delay = delay; +function resetDefaultSettings() { + return __awaiter(this, void 0, void 0, function* () { + const config = vscode.workspace.getConfiguration('phpAddProperty'); + for (const key in config) { + if (config.hasOwnProperty(key)) { + yield setDefaultSetting(config, config[key], key); + } + } + const constructorConfig = vscode.workspace.getConfiguration('phpAddProperty.constructor'); + for (const setting in constructorConfig) { + if (constructorConfig.hasOwnProperty(setting)) { + yield setDefaultSetting(constructorConfig, constructorConfig[setting], setting); + } + } + }); +} +exports.resetDefaultSettings = resetDefaultSettings; +function setDefaultSetting(config, value, parentKey) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof value === 'function') { + return; + } + if (typeof value !== 'object') { + yield config.update(parentKey, undefined, true); + return; + } + for (const key in value) { + if (value.hasOwnProperty(key)) { + setDefaultSetting(config, value[key], [parentKey, key].join('.')); + } + } + }); +} +//# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/out/test/suite/utils.js.map b/out/test/suite/utils.js.map new file mode 100644 index 0000000..2665423 --- /dev/null +++ b/out/test/suite/utils.js.map @@ -0,0 +1 @@ +{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/test/suite/utils.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,iCAAiC;AAEpB,QAAA,qBAAqB,GAAG,EAAE,CAAC;AAExC,SAAgB,KAAK,CAAC,OAAe,EAAE,QAAkB;IACrD,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE;QACzB,UAAU,CAAC,GAAG,EAAE;YACZ,QAAQ,EAAE,CAAC;YACX,OAAO,EAAE,CAAC;QACd,CAAC,EAAE,OAAO,GAAG,6BAAqB,CAAC,CAAC;IACxC,CAAC,C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27470f3 --- /dev/null +++ b/out/utils.js @@ -0,0 +1,154 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const vscode = require("vscode"); +const constants_1 = require("./constants"); +function getVisibilityChoice(defaultValue) { + let visibilityChoices = ['public', 'protected', 'private']; + if (visibilityChoices.indexOf(defaultValue) !== -1) { + visibilityChoices.splice(visibilityChoices.indexOf(defaultValue), 1); + } + return `|${[defaultValue, ...visibilityChoices].join(',')}|`; +} +exports.getVisibilityChoice = getVisibilityChoice; +function extractConstructorParts(text) { + const regex = /(.*__construct\s*)\(((?:\s|\S)*?)(?=\))\s*\)\s*{/; + const match = regex.exec(text); + return match; +} +function getMultilineConstructorText(text, functionDefinition, parametersText) { + const parameters = parametersText.split(',').map(parameter => indentText(parameter.trim(), 2)); + const multilineConstructorText = functionDefinition + + '(\n' + + `${parameters.join(',\n')}\n` + + indentText(') {'); + return text.replace(text, multilineConstructorText); +} +function breakConstructorIntoMultiline(text) { + if (config('phpAddProperty.constructor.breakIntoMultilineIfLengthExceeded.enabled') !== true) { + return text; + } + const match = extractConstructorParts(text); + if (!match) { + return text; + } + const constructorLineText = match[0]; + const maxLineLength = config('phpAddProperty.constructor.breakIntoMultilineIfLengthExceeded.maxLineLength'); + if (constructorLineText.length <= maxLineLength) { + return text; + } + return text.replace(constructorLineText, getMultilineConstructorText(constructorLineText, match[1], match[2])); +} +exports.breakConstructorIntoMultiline = breakConstructorIntoMultiline; +function forceBreakConstructorIntoMultiline(text) { + const match = extractConstructorParts(text); + if (!match) { + return text; + } + return text.replace(match[0], getMultilineConstructorText(match[0], match[1], match[2])); +} +exports.forceBreakConstructorIntoMultiline = forceBreakConstructorIntoMultiline; +function getPropertyNameFromLineText(lineText, document, phpEngine, cursorPosition) { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o; + const paramRegex = /@param(?:\s+\S+)?\s+\$(\S+).*/; + const matchParam = paramRegex.exec(lineText); + if (matchParam) { + return matchParam[1]; + } + else { + const lineAst = phpEngine.parseEval(`class A { ${lineText} }`); + const selectedWord = document.getText(document.getWordRangeAtPosition(cursorPosition)).replace(/^\$/, ''); + if (((_b = (_a = lineAst.children[0]) === null || _a === void 0 ? void 0 : _a.body[0]) === null || _b === void 0 ? void 0 : _b.kind) === 'propertystatement') { + const properties = lineAst.children[0].body[0].properties; + const propertyAst = (_c = properties.find((propertyAst) => { var _a; return ((_a = propertyAst.name) === null || _a === void 0 ? void 0 : _a.name) === selectedWord; })) !== null && _c !== void 0 ? _c : properties[0]; + let propertyName = (_d = propertyAst.name) === null || _d === void 0 ? void 0 : _d.name; + if (propertyName === 'this') { + const assignmentAst = phpEngine.parseEval(`class A { public function __construct() { ${lineText} } }`); + if (((_h = (_g = (_f = (_e = assignmentAst.children[0]) === null || _e === void 0 ? void 0 : _e.body[0]) === null || _f === void 0 ? void 0 : _f.body) === null || _g === void 0 ? void 0 : _g.children[0]) === null || _h === void 0 ? void 0 : _h.kind) === 'expressionstatement') { + propertyName = (_j = assignmentAst.children[0].body[0].body.children[0].expression.right) === null || _j === void 0 ? void 0 : _j.name; + } + } + return propertyName; + } + else if (((_l = (_k = lineAst.children[0]) === null || _k === void 0 ? void 0 : _k.body[0]) === null || _l === void 0 ? void 0 : _l.kind) === 'method') { + const constructorArgs = lineAst.children[0].body[0].arguments; + const argumentAst = (_m = constructorArgs.find((propertyAst) => { var _a; return ((_a = propertyAst.name) === null || _a === void 0 ? void 0 : _a.name) === selectedWord; })) !== null && _m !== void 0 ? _m : constructorArgs[0]; + return (_o = argumentAst.name) === null || _o === void 0 ? void 0 : _o.name; + } + } +} +exports.getPropertyNameFromLineText = getPropertyNameFromLineText; +function calculateIndentationLevel(index) { + return Math.floor(index / configUsingResource('editor.tabSize')); +} +exports.calculateIndentationLevel = calculateIndentationLevel; +function getLineFirstNonIndentationCharacterIndex(lineText) { + const tabSize = configUsingResource('editor.tabSize'); + let index = 0; + for (let i = 0; i < lineText.length; i++) { + const char = lineText[i]; + if (/[^\s\t]/.test(char)) { + index++; + break; + } + index += char === "\t" ? tabSize : 1; + } + return index; +} +exports.getLineFirstNonIndentationCharacterIndex = getLineFirstNonIndentationCharacterIndex; +function indentText(text, level = 1) { + /** + * Good to have + * Listen for view options changes and use these values + * https://github.com/jedmao/tabsanity-vs/blob/faa41a99ccb47c8e7717edfcbdfba4c093e670fe/TabSanity/TabOptionsListener.cs + */ + let tab = "\t"; + if (configUsingResource('editor.insertSpaces')) { + const tabSize = configUsingResource('editor.tabSize'); + tab = ' '.repeat(tabSize); + } + return tab.repeat(level) + text; +} +exports.indentText = indentText; +function configUsingResource(key) { + var _a; + const parts = key.split(/\.(.+)/, 2); + const configuration = vscode.workspace.getConfiguration(parts[0], (_a = vscode.window.activeTextEditor) === null || _a === void 0 ? void 0 : _a.document.uri); + return parts[1] ? configuration.get(parts[1]) : configuration; +} +exports.configUsingResource = configUsingResource; +function config(key) { + return vscode.workspace.getConfiguration().get(key); +} +exports.config = config; +function escapeForRegExp(text) { + return text.replace(/[.*+\-?^${}()|[\]\\]/g, '\\$&'); +} +exports.escapeForRegExp = escapeForRegExp; +function escapeForSnippet(text) { + return text.replace(/(? { + editBuilder.replace(range, "\n".repeat(rangeLines)); + }, { + undoStopBefore: true, + undoStopAfter: false + }).then(() => { + const editor = vscode.window.activeTextEditor; + if (editor) { + editor.insertSnippet(new vscode.SnippetString(snippet), range, { + undoStopBefore: false, + undoStopAfter: false, + }); + } + }); +} +exports.replaceWithSnippet = replaceWithSnippet; +function isDebugMode() { + return process.env[constants_1.debugEnvName] === "true"; +} +exports.isDebugMode = isDebugMode; +//# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/out/utils.js.map b/out/utils.js.map new file mode 100644 index 0000000..7e8196b --- /dev/null +++ b/out/utils.js.map @@ -0,0 +1 @@ +{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;AAAA,iCAAiC;AAEjC,2CAA2C;AAE3C,SAAgB,mBAAmB,CAAC,YAAoB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KACvB,EACH,IAAI,CAAC,GAAG,EAAE;QACR,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC;QAE9C,IAAI,MAAM,EAAE;YACR,MAAM,CAAC,aAAa,CAChB,IAAI,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,EACjC,KAAK,EACL;gBACI,cAAc,EAAE,KAAK;gBACrB,aAAa,EAAE,KAAK;aACvB,CACJ,CAAC;SACL;IACL,CAAC,EAAE;AACP,CAAC;AAzBD,gDAyBC;AAED,SAAgB,WAAW;IACvB,OAAO,OAAO,CAAC,GAAG,CAAC,wBAAY,CAAC,KAAK,MAAM,CAAC;AAChD,CAAC;AAFD,kCAEC"} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 40789d4..463652d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,29 +1,47 @@ { "name": "php-add-property", - "version": "0.4.1", + "version": "1.1.0", "lockfileVersion": 1, "requires": true, "dependencies": { "@babel/code-frame": { - "version": "7.5.5", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.5.5.tgz", - "integrity": "sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw==", + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.8.3.tgz", + "integrity": "sha512-a9gxpmdXtZEInkCSHUJDLHZVBgb1QS0jhss4cPP93EW7s+uC5bikET2twEF3KV+7rDblJcmNvTR7VJejqd2C2g==", "dev": true, "requires": { - "@babel/highlight": "^7.0.0" + "@babel/highlight": "^7.8.3" } }, + "@babel/helper-validator-identifier": { + "version": "7.9.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.9.5.tgz", + "integrity": "sha512-/8arLKUFq882w4tWGj9JYzRpAlZgiWUJ+dtteNTDqrRBz9Iguck9Rn3ykuBDoUwh2TO4tSAJlrxDUOXWklJe4g==", + "dev": true + }, "@babel/highlight": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.5.0.tgz", - "integrity": "sha512-7dV4eu9gBxoM0dAnj/BCFDW9LFU0zvTrkq0ugM7pnHEgguOEeOz1so2ZghEdzviYzQEED0r4EAgpsBChKy1TRQ==", + "version": "7.9.0", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.9.0.tgz", + "integrity": "sha512-lJZPilxX7Op3Nv/2cvFdnlepPXDxi29wxteT57Q965oc5R9v86ztx0jfxVrTcBk8C2kcPkkDa2Z4T3ZsPPVWsQ==", "dev": true, "requires": { + "@babel/helper-validator-identifier": "^7.9.0", "chalk": "^2.0.0", - "esutils": "^2.0.2", "js-tokens": "^4.0.0" } }, + "@types/color-name": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", + "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==", + "dev": true + }, + "@types/eslint-visitor-keys": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz", + "integrity": "sha512-OCutwjDZ4aFS6PB1UZ988C4YgwlBHJd6wCeQqaLdmadZ/7e+w79+hbMUFC1QXDNCmdyoRfAFdm0RypzwR+Qpag==", + "dev": true + }, "@types/events": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/@types/events/-/events-3.0.0.tgz", @@ -41,6 +59,12 @@ "@types/node": "*" } }, + "@types/json-schema": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.4.tgz", + "integrity": "sha512-8+KAKzEvSUdeo+kmqnKrqgeE+LcA0tjYWFY7RPProVYwnqDjukzO+3b6dLD56rYX5TdWejnEOLJYOIeh4CXKuA==", + "dev": true + }, "@types/minimatch": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", @@ -48,33 +72,84 @@ "dev": true }, "@types/mocha": { - "version": "5.2.6", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.6.tgz", - "integrity": "sha512-1axi39YdtBI7z957vdqXI4Ac25e7YihYQtJa+Clnxg1zTJEaIRbndt71O3sP4GAMgiAm0pY26/b9BrY4MR/PMw==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-7.0.2.tgz", + "integrity": "sha512-ZvO2tAcjmMi8V/5Z3JsyofMe3hasRcaw88cto5etSVMwVQfeivGAlEYmaQgceUSVYFofVjT+ioHsATjdWcFt1w==", "dev": true }, "@types/node": { - "version": "10.14.19", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.19.tgz", - "integrity": "sha512-j6Sqt38ssdMKutXBUuAcmWF8QtHW1Fwz/mz4Y+Wd9mzpBiVFirjpNQf363hG5itkG+yGaD+oiLyb50HxJ36l9Q==", + "version": "13.13.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-13.13.5.tgz", + "integrity": "sha512-3ySmiBYJPqgjiHA7oEaIo2Rzz0HrOZ7yrNO5HWyaE5q0lQ3BppDZ3N53Miz8bw2I7gh1/zir2MGVZBvpb1zq9g==", "dev": true }, "@types/vscode": { - "version": "1.38.0", - "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.38.0.tgz", - "integrity": "sha512-aGo8LQ4J1YF0T9ORuCO+bhQ5sGR1MXa7VOyOdEP685se3wyQWYUExcdiDi6rvaK61KUwfzzA19JRLDrUbDl7BQ==", + "version": "1.31.0", + "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.31.0.tgz", + "integrity": "sha512-uUpjvtrQ14ZEqqRE/EGuBvGbm9GuxDp76mtsnw3goMogsWmEEYS/y4eL2Zwf0rbFMh/hg3hEs+E3CvuuNEs+GA==", "dev": true }, + "@typescript-eslint/eslint-plugin": { + "version": "2.31.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.31.0.tgz", + "integrity": "sha512-iIC0Pb8qDaoit+m80Ln/aaeu9zKQdOLF4SHcGLarSeY1gurW6aU4JsOPMjKQwXlw70MvWKZQc6S2NamA8SJ/gg==", + "dev": true, + "requires": { + "@typescript-eslint/experimental-utils": "2.31.0", + "functional-red-black-tree": "^1.0.1", + "regexpp": "^3.0.0", + "tsutils": "^3.17.1" + } + }, + "@typescript-eslint/experimental-utils": { + "version": "2.31.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.31.0.tgz", + "integrity": "sha512-MI6IWkutLYQYTQgZ48IVnRXmLR/0Q6oAyJgiOror74arUMh7EWjJkADfirZhRsUMHeLJ85U2iySDwHTSnNi9vA==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.3", + "@typescript-eslint/typescript-estree": "2.31.0", + "eslint-scope": "^5.0.0", + "eslint-utils": "^2.0.0" + } + }, + "@typescript-eslint/parser": { + "version": "2.31.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.31.0.tgz", + "integrity": "sha512-uph+w6xUOlyV2DLSC6o+fBDzZ5i7+3/TxAsH4h3eC64tlga57oMb96vVlXoMwjR/nN+xyWlsnxtbDkB46M2EPQ==", + "dev": true, + "requires": { + "@types/eslint-visitor-keys": "^1.0.0", + "@typescript-eslint/experimental-utils": "2.31.0", + "@typescript-eslint/typescript-estree": "2.31.0", + "eslint-visitor-keys": "^1.1.0" + } + }, + "@typescript-eslint/typescript-estree": { + "version": "2.31.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.31.0.tgz", + "integrity": "sha512-vxW149bXFXXuBrAak0eKHOzbcu9cvi6iNcJDzEtOkRwGHxJG15chiAQAwhLOsk+86p9GTr/TziYvw+H9kMaIgA==", + "dev": true, + "requires": { + "debug": "^4.1.1", + "eslint-visitor-keys": "^1.1.0", + "glob": "^7.1.6", + "is-glob": "^4.0.1", + "lodash": "^4.17.15", + "semver": "^6.3.0", + "tsutils": "^3.17.1" + } + }, "acorn": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.3.0.tgz", - "integrity": "sha512-/czfa8BwS88b9gWQVhc8eknunSA2DoJpJyTQkhheIf5E48u1N0R4q/YxxsAeqRrmK9TQ/uYfgLDfZo91UlANIA==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.1.tgz", + "integrity": "sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg==", "dev": true }, "acorn-jsx": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.0.2.tgz", - "integrity": "sha512-tiNTrP1MP0QrChmD2DdupCr6HWSFeKVw5d/dHTu4Y7rkAkRhU/Dt7dphAfIUyxtHpl/eBVip5uTNSpQJHylpAw==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.2.0.tgz", + "integrity": "sha512-HiUX/+K2YpkpJ+SzBffkM/AQ2YE03S0U1kjTLVpoJdhZMOWy8qvXVN9JdLqv2QsaQ6MPYQIuNmwD8zOiYUofLQ==", "dev": true }, "agent-base": { @@ -87,12 +162,12 @@ } }, "ajv": { - "version": "6.10.2", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.2.tgz", - "integrity": "sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw==", + "version": "6.12.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.2.tgz", + "integrity": "sha512-k+V+hzjm5q/Mr8ef/1Y9goCmlsK4I6Sm74teeyGvFk1XrOsbsKLjEdrvny42CZ+a8sXbk8KWpY/bDwS+FLL2UQ==", "dev": true, "requires": { - "fast-deep-equal": "^2.0.1", + "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" @@ -105,15 +180,26 @@ "dev": true }, "ansi-escapes": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.2.0.tgz", - "integrity": "sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ==", - "dev": true + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.1.tgz", + "integrity": "sha512-JWF7ocqNrp8u9oqpgV+wH5ftbt+cfvv+PTjOvKLT3AdYly/LmORARfEVT1iyjwN+4MqE5UmVKoAdIBqeoCHgLA==", + "dev": true, + "requires": { + "type-fest": "^0.11.0" + }, + "dependencies": { + "type-fest": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.11.0.tgz", + "integrity": "sha512-OdjXJxnCN1AvyLSzeKIgXTXxV+99ZuXl3Hpo9XpJAv9MBcHrrJOQ5kV7ypXOuQie+AmWG25hLbiKdwYTifzcfQ==", + "dev": true + } + } }, "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", "dev": true }, "ansi-styles": { @@ -125,6 +211,16 @@ "color-convert": "^1.9.0" } }, + "anymatch": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", + "integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==", + "dev": true, + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } + }, "argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", @@ -140,28 +236,16 @@ "integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==", "dev": true }, - "azure-devops-node-api": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/azure-devops-node-api/-/azure-devops-node-api-7.2.0.tgz", - "integrity": "sha512-pMfGJ6gAQ7LRKTHgiRF+8iaUUeGAI0c8puLaqHLc7B8AR7W6GJLozK9RFeUHFjEGybC9/EB3r67WPd7e46zQ8w==", - "dev": true, - "requires": { - "os": "0.1.1", - "tunnel": "0.0.4", - "typed-rest-client": "1.2.0", - "underscore": "1.8.3" - } - }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "dev": true }, - "boolbase": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", - "integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=", + "binary-extensions": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.0.0.tgz", + "integrity": "sha512-Phlt0plgpIIBOGTT/ehfFnbNlfsDEiqmzE2KRXoX1bLIlir4X/MR+zSyBEkL05ffWgnRSf/DXv+WrUAVr93/ow==", "dev": true }, "brace-expansion": { @@ -174,18 +258,21 @@ "concat-map": "0.0.1" } }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, "browser-stdout": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", "dev": true }, - "buffer-crc32": { - "version": "0.2.13", - "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", - "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=", - "dev": true - }, "callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", @@ -215,52 +302,73 @@ "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", "dev": true }, - "cheerio": { - "version": "1.0.0-rc.3", - "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.3.tgz", - "integrity": "sha512-0td5ijfUPuubwLUu0OBoe98gZj8C/AA+RW3v67GPlGOrvxWjZmBXiBCRU+I8VEiNyJzjth40POfHiz2RB3gImA==", + "chokidar": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.3.0.tgz", + "integrity": "sha512-dGmKLDdT3Gdl7fBUe8XK+gAtGmzy5Fn0XkkWQuYxGIgWVPPse2CxFA5mtrlD0TOHaHjEUqkWNyP1XdHoJES/4A==", "dev": true, "requires": { - "css-select": "~1.2.0", - "dom-serializer": "~0.1.1", - "entities": "~1.1.1", - "htmlparser2": "^3.9.1", - "lodash": "^4.15.0", - "parse5": "^3.0.1" + "anymatch": "~3.1.1", + "braces": "~3.0.2", + "fsevents": "~2.1.1", + "glob-parent": "~5.1.0", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.2.0" } }, "cli-cursor": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", - "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", + "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", "dev": true, "requires": { - "restore-cursor": "^2.0.0" + "restore-cursor": "^3.1.0" } }, "cli-width": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz", - "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=", + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.1.tgz", + "integrity": "sha512-GRMWDxpOB6Dgk2E5Uo+3eEBvtOOlimMmpbFiKuLFnQzYDavtLFY3K5ona41jgN/WdRZtG7utuVSVTL4HbZHGkw==", "dev": true }, "cliui": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-4.1.0.tgz", - "integrity": "sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", + "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", "dev": true, "requires": { - "string-width": "^2.1.1", - "strip-ansi": "^4.0.0", - "wrap-ansi": "^2.0.0" + "string-width": "^3.1.0", + "strip-ansi": "^5.2.0", + "wrap-ansi": "^5.1.0" + }, + "dependencies": { + "emoji-regex": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + } } }, - "code-point-at": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", - "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", - "dev": true - }, "color-convert": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", @@ -276,12 +384,6 @@ "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", "dev": true }, - "commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", - "dev": true - }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -299,26 +401,16 @@ "semver": "^5.5.0", "shebang-command": "^1.2.0", "which": "^1.2.9" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } } }, - "css-select": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz", - "integrity": "sha1-KzoRBTnFNV8c2NMUYj6HCxIeyFg=", - "dev": true, - "requires": { - "boolbase": "~1.0.0", - "css-what": "2.1", - "domutils": "1.5.1", - "nth-check": "~1.0.1" - } - }, - "css-what": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/css-what/-/css-what-2.1.3.tgz", - "integrity": "sha512-a+EPoD+uZiNfh+5fxw2nO9QwFa6nJe2Or35fGY6Ipw1R3R4AGz1d1TEZrCegvw2YTmZ0jXirGYlzxxpYSHwpEg==", - "dev": true - }, "debug": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", @@ -349,18 +441,6 @@ "object-keys": "^1.0.12" } }, - "denodeify": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/denodeify/-/denodeify-1.2.1.tgz", - "integrity": "sha1-OjYof1A05pnnV3kBBSwubJQlFjE=", - "dev": true - }, - "didyoumean": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.1.tgz", - "integrity": "sha1-6S7f2tplN9SE1zwBcv0eugxJdv8=", - "dev": true - }, "diff": { "version": "3.5.0", "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", @@ -376,80 +456,35 @@ "esutils": "^2.0.2" } }, - "dom-serializer": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.1.tgz", - "integrity": "sha512-l0IU0pPzLWSHBcieZbpOKgkIn3ts3vAh7ZuFyXNwJxJXk/c4Gwj9xaTJwIDVQCXawWD0qb3IzMGH5rglQaO0XA==", - "dev": true, - "requires": { - "domelementtype": "^1.3.0", - "entities": "^1.1.1" - } - }, - "domelementtype": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.1.tgz", - "integrity": "sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w==", - "dev": true - }, - "domhandler": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.4.2.tgz", - "integrity": "sha512-JiK04h0Ht5u/80fdLMCEmV4zkNh2BcoMFBmZ/91WtYZ8qVXSKjiw7fXMgFPnHcSZgOo3XdinHvmnDUeMf5R4wA==", - "dev": true, - "requires": { - "domelementtype": "1" - } - }, - "domutils": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.5.1.tgz", - "integrity": "sha1-3NhIiib1Y9YQeeSMn3t+Mjc2gs8=", - "dev": true, - "requires": { - "dom-serializer": "0", - "domelementtype": "1" - } - }, "emoji-regex": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", - "dev": true - }, - "end-of-stream": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", - "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", - "dev": true, - "requires": { - "once": "^1.4.0" - } - }, - "entities": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz", - "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true }, "es-abstract": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.13.0.tgz", - "integrity": "sha512-vDZfg/ykNxQVwup/8E1BZhVzFfBxs9NqMzGcvIJrqg5k2/5Za2bWo40dK2J1pgLngZ7c+Shh8lwYtLGyrwPutg==", + "version": "1.17.5", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.5.tgz", + "integrity": "sha512-BR9auzDbySxOcfog0tLECW8l28eRGpDpU3Dm3Hp4q/N+VtLTmyj4EUN088XZWQDW/hzj6sYRDXeOFsaAODKvpg==", "dev": true, "requires": { - "es-to-primitive": "^1.2.0", + "es-to-primitive": "^1.2.1", "function-bind": "^1.1.1", "has": "^1.0.3", - "is-callable": "^1.1.4", - "is-regex": "^1.0.4", - "object-keys": "^1.0.12" + "has-symbols": "^1.0.1", + "is-callable": "^1.1.5", + "is-regex": "^1.0.5", + "object-inspect": "^1.7.0", + "object-keys": "^1.1.1", + "object.assign": "^4.1.0", + "string.prototype.trimleft": "^2.1.1", + "string.prototype.trimright": "^2.1.1" } }, "es-to-primitive": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.0.tgz", - "integrity": "sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", "dev": true, "requires": { "is-callable": "^1.1.4", @@ -479,53 +514,71 @@ "dev": true }, "eslint": { - "version": "5.16.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-5.16.0.tgz", - "integrity": "sha512-S3Rz11i7c8AA5JPv7xAH+dOyq/Cu/VXHiHXBPOU1k/JAM5dXqQPt3qcrhpHSorXmrpu2g0gkIBVXAqCpzfoZIg==", + "version": "6.8.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-6.8.0.tgz", + "integrity": "sha512-K+Iayyo2LtyYhDSYwz5D5QdWw0hCacNzyq1Y821Xna2xSJj7cijoLLYmLxTQgcgZ9mC61nryMy9S7GRbYpI5Ig==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", - "ajv": "^6.9.1", + "ajv": "^6.10.0", "chalk": "^2.1.0", "cross-spawn": "^6.0.5", "debug": "^4.0.1", "doctrine": "^3.0.0", - "eslint-scope": "^4.0.3", - "eslint-utils": "^1.3.1", - "eslint-visitor-keys": "^1.0.0", - "espree": "^5.0.1", + "eslint-scope": "^5.0.0", + "eslint-utils": "^1.4.3", + "eslint-visitor-keys": "^1.1.0", + "espree": "^6.1.2", "esquery": "^1.0.1", "esutils": "^2.0.2", "file-entry-cache": "^5.0.1", "functional-red-black-tree": "^1.0.1", - "glob": "^7.1.2", - "globals": "^11.7.0", + "glob-parent": "^5.0.0", + "globals": "^12.1.0", "ignore": "^4.0.6", "import-fresh": "^3.0.0", "imurmurhash": "^0.1.4", - "inquirer": "^6.2.2", - "js-yaml": "^3.13.0", + "inquirer": "^7.0.0", + "is-glob": "^4.0.0", + "js-yaml": "^3.13.1", "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.3.0", - "lodash": "^4.17.11", + "lodash": "^4.17.14", "minimatch": "^3.0.4", "mkdirp": "^0.5.1", "natural-compare": "^1.4.0", - "optionator": "^0.8.2", - "path-is-inside": "^1.0.2", + "optionator": "^0.8.3", "progress": "^2.0.0", "regexpp": "^2.0.1", - "semver": "^5.5.1", - "strip-ansi": "^4.0.0", - "strip-json-comments": "^2.0.1", + "semver": "^6.1.2", + "strip-ansi": "^5.2.0", + "strip-json-comments": "^3.0.1", "table": "^5.2.3", - "text-table": "^0.2.0" + "text-table": "^0.2.0", + "v8-compile-cache": "^2.0.3" + }, + "dependencies": { + "eslint-utils": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.4.3.tgz", + "integrity": "sha512-fbBN5W2xdY45KulGXmLHZ3c3FHfVYmKg0IrAKGOkT/464PQsx2UeIzfz1RmEci+KLm1bBaAzZAh8+/E+XAeZ8Q==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^1.1.0" + } + }, + "regexpp": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-2.0.1.tgz", + "integrity": "sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw==", + "dev": true + } } }, "eslint-scope": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.3.tgz", - "integrity": "sha512-p7VutNr1O/QrxysMo3E45FjYDTeXBy0iTltPFNSqKAIfjDSXC+4dj+qfyuD8bfAXrW/y6lW3O76VaYNPKfpKrg==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.0.0.tgz", + "integrity": "sha512-oYrhJW7S0bxAFDvWqzvMPRm6pcgcnWc4QnofCAqRTRfQC0JcwenzGglTtsLyIuuWFfkqDG9vz67cnttSd53djw==", "dev": true, "requires": { "esrecurse": "^4.1.0", @@ -533,12 +586,12 @@ } }, "eslint-utils": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.4.2.tgz", - "integrity": "sha512-eAZS2sEUMlIeCjBeubdj45dmBHQwPHWyBcT1VSYB7o9x9WRRqKxyUoiXlRjyAwzN7YEzHJlYg0NmzDRWx6GP4Q==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.0.0.tgz", + "integrity": "sha512-0HCPuJv+7Wv1bACm8y5/ECVfYdfsAm9xmVb7saeFlxjPYALefjhbYoCkBjPdPzGH8wWyTpAez82Fh3VKYEZ8OA==", "dev": true, "requires": { - "eslint-visitor-keys": "^1.0.0" + "eslint-visitor-keys": "^1.1.0" } }, "eslint-visitor-keys": { @@ -548,14 +601,14 @@ "dev": true }, "espree": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-5.0.1.tgz", - "integrity": "sha512-qWAZcWh4XE/RwzLJejfcofscgMc9CamR6Tn1+XRXNzrvUSSbiAjGOI/fggztjIi7y9VLPqnICMIPiGyr8JaZ0A==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-6.2.1.tgz", + "integrity": "sha512-ysCxRQY3WaXJz9tdbWOwuWr5Y/XrPTGX9Kiz3yoUXwW0VZ4w30HTkQLaGx/+ttFjF8i+ACbArnB4ce68a9m5hw==", "dev": true, "requires": { - "acorn": "^6.0.7", - "acorn-jsx": "^5.0.0", - "eslint-visitor-keys": "^1.0.0" + "acorn": "^7.1.1", + "acorn-jsx": "^5.2.0", + "eslint-visitor-keys": "^1.1.0" } }, "esprima": { @@ -565,12 +618,20 @@ "dev": true }, "esquery": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.0.1.tgz", - "integrity": "sha512-SmiyZ5zIWH9VM+SRUReLS5Q8a7GxtRdxEBVZpm98rJM7Sb+A9DVCndXfkeFUd3byderg+EbDkfnevfCwynWaNA==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.3.1.tgz", + "integrity": "sha512-olpvt9QG0vniUBZspVRN6lwB7hOZoTRtT+jzR+tS4ffYx2mzbw+z0XCOk44aaLYKApNX5nMm+E+P6o25ip/DHQ==", "dev": true, "requires": { - "estraverse": "^4.0.0" + "estraverse": "^5.1.0" + }, + "dependencies": { + "estraverse": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.1.0.tgz", + "integrity": "sha512-FyohXK+R0vE+y1nHLoBM7ZTyqRpqAlhdZHCWIWEviFLiGB8b04H6bQs8G+XTthacvT8VuwvteiP7RJSxMs8UEw==", + "dev": true + } } }, "esrecurse": { @@ -594,21 +655,6 @@ "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", "dev": true }, - "execa": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", - "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", - "dev": true, - "requires": { - "cross-spawn": "^6.0.0", - "get-stream": "^4.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - } - }, "external-editor": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", @@ -621,15 +667,15 @@ } }, "fast-deep-equal": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", - "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz", + "integrity": "sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA==", "dev": true }, "fast-json-stable-stringify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", - "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", "dev": true }, "fast-levenshtein": { @@ -638,19 +684,10 @@ "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", "dev": true }, - "fd-slicer": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", - "integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=", - "dev": true, - "requires": { - "pend": "~1.2.0" - } - }, "figures": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", - "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", + "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", "dev": true, "requires": { "escape-string-regexp": "^1.0.5" @@ -665,6 +702,15 @@ "flat-cache": "^2.0.1" } }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, "find-up": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", @@ -695,9 +741,9 @@ } }, "flatted": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.1.tgz", - "integrity": "sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.2.tgz", + "integrity": "sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==", "dev": true }, "fs.realpath": { @@ -706,6 +752,13 @@ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true }, + "fsevents": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.2.tgz", + "integrity": "sha512-R4wDiBwZ0KzpgOWetKDug1FZcYhqYnUYKtfZYt4mD5SBz76q0KR4Q9o7GIPamsVPGmW3EYPPJ0dOOjvx32ldZA==", + "dev": true, + "optional": true + }, "function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", @@ -724,19 +777,10 @@ "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", "dev": true }, - "get-stream": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", - "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", - "dev": true, - "requires": { - "pump": "^3.0.0" - } - }, "glob": { - "version": "7.1.4", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", - "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", "dev": true, "requires": { "fs.realpath": "^1.0.0", @@ -747,11 +791,23 @@ "path-is-absolute": "^1.0.0" } }, + "glob-parent": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz", + "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + }, "globals": { - "version": "11.12.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", - "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", - "dev": true + "version": "12.4.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz", + "integrity": "sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg==", + "dev": true, + "requires": { + "type-fest": "^0.8.1" + } }, "growl": { "version": "1.10.5", @@ -775,9 +831,9 @@ "dev": true }, "has-symbols": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz", - "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", + "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", "dev": true }, "he": { @@ -786,20 +842,6 @@ "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", "dev": true }, - "htmlparser2": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.10.1.tgz", - "integrity": "sha512-IgieNijUMbkDovyoKObU1DUhm1iwNYE/fuifEoEHfd1oZKZDaONBSkal7Y01shxsM49R4XaMdGez3WnF9UfiCQ==", - "dev": true, - "requires": { - "domelementtype": "^1.3.1", - "domhandler": "^2.3.0", - "domutils": "^1.5.1", - "entities": "^1.1.1", - "inherits": "^2.0.1", - "readable-stream": "^3.1.1" - } - }, "http-proxy-agent": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-2.1.0.tgz", @@ -828,9 +870,9 @@ } }, "https-proxy-agent": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.2.tgz", - "integrity": "sha512-c8Ndjc9Bkpfx/vCJueCPy0jlP4ccCCSNDp8xwCZzPjKJUm+B+u9WX2x98Qx4n1PiMNTWo3D7KK5ifNV/yJyRzg==", + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.4.tgz", + "integrity": "sha512-OmvfoQ53WLjtA9HeYP9RNrWMJzzAz1JGaSFr1nijg0PVR1JaD/xbJq1mdEIIlxGpXp9eSe/O2LgU9DJmTPd0Eg==", "dev": true, "requires": { "agent-base": "^4.3.0", @@ -864,9 +906,9 @@ "dev": true }, "import-fresh": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.1.0.tgz", - "integrity": "sha512-PpuksHKGt8rXfWEr9m9EHIpgyyaltBy8+eF6GJM0QCAxMgxCfucMF3mjecK2QsJr0amJW7gTqh5/wht0z2UhEQ==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.1.tgz", + "integrity": "sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ==", "dev": true, "requires": { "parent-module": "^1.0.0", @@ -896,101 +938,157 @@ "dev": true }, "inquirer": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.5.2.tgz", - "integrity": "sha512-cntlB5ghuB0iuO65Ovoi8ogLHiWGs/5yNrtUcKjFhSSiVeAIVpD7koaSU9RM8mpXw5YDi9RdYXGQMaOURB7ycQ==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.1.0.tgz", + "integrity": "sha512-5fJMWEmikSYu0nv/flMc475MhGbB7TSPd/2IpFV4I4rMklboCH2rQjYY5kKiYGHqUF9gvaambupcJFFG9dvReg==", "dev": true, "requires": { - "ansi-escapes": "^3.2.0", - "chalk": "^2.4.2", - "cli-cursor": "^2.1.0", + "ansi-escapes": "^4.2.1", + "chalk": "^3.0.0", + "cli-cursor": "^3.1.0", "cli-width": "^2.0.0", "external-editor": "^3.0.3", - "figures": "^2.0.0", - "lodash": "^4.17.12", - "mute-stream": "0.0.7", - "run-async": "^2.2.0", - "rxjs": "^6.4.0", - "string-width": "^2.1.0", - "strip-ansi": "^5.1.0", + "figures": "^3.0.0", + "lodash": "^4.17.15", + "mute-stream": "0.0.8", + "run-async": "^2.4.0", + "rxjs": "^6.5.3", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0", "through": "^2.3.6" }, "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", "dev": true, "requires": { - "ansi-regex": "^4.1.0" + "ansi-regex": "^5.0.0" + } + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" } } } }, - "invert-kv": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-2.0.0.tgz", - "integrity": "sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA==", - "dev": true + "is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "requires": { + "binary-extensions": "^2.0.0" + } }, "is-buffer": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.3.tgz", - "integrity": "sha512-U15Q7MXTuZlrbymiz95PJpZxu8IlipAp4dtS3wOdgPXx3mqBnslrWU14kxfHB+Py/+2PVKSr37dMAgM2A4uArw==", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.4.tgz", + "integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A==", "dev": true }, "is-callable": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", - "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==", + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.5.tgz", + "integrity": "sha512-ESKv5sMCJB2jnHTWZ3O5itG+O128Hsus4K4Qh1h2/cgn2vbgnLSVqfV46AeJA9D5EeeLa9w81KUXMtn34zhX+Q==", "dev": true }, "is-date-object": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz", - "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.2.tgz", + "integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==", "dev": true }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", "dev": true }, - "is-promise": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", - "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=", + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", "dev": true }, - "is-regex": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", - "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", + "is-glob": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", + "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", "dev": true, "requires": { - "has": "^1.0.1" + "is-extglob": "^2.1.1" } }, - "is-stream": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", "dev": true }, + "is-regex": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.5.tgz", + "integrity": "sha512-vlKW17SNq44owv5AQR3Cq0bQPEb8+kF3UKZ2fiZNOWtztYE5i0CzCZxFDwO58qAOWtxdBRVO/V5Qin1wjCqFYQ==", + "dev": true, + "requires": { + "has": "^1.0.3" + } + }, "is-symbol": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.2.tgz", - "integrity": "sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz", + "integrity": "sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ==", "dev": true, "requires": { - "has-symbols": "^1.0.0" + "has-symbols": "^1.0.1" } }, "isexe": { @@ -1027,15 +1125,6 @@ "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", "dev": true }, - "lcid": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/lcid/-/lcid-2.0.0.tgz", - "integrity": "sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA==", - "dev": true, - "requires": { - "invert-kv": "^2.0.0" - } - }, "levn": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", @@ -1046,15 +1135,6 @@ "type-check": "~0.3.2" } }, - "linkify-it": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-2.2.0.tgz", - "integrity": "sha512-GnAl/knGn+i1U/wjBz3akz2stz+HrHLsxMwHQGofCDfPvlf+gDKN58UtfmUquTY4/MXeE2x7k19KQmeoZi94Iw==", - "dev": true, - "requires": { - "uc.micro": "^1.0.1" - } - }, "locate-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", @@ -1066,77 +1146,24 @@ } }, "lodash": { - "version": "4.17.15", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", - "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", + "version": "4.17.20", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", + "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==", "dev": true }, "log-symbols": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-2.2.0.tgz", - "integrity": "sha512-VeIAFslyIerEJLXHziedo2basKbMKtTw3vfn5IzG0XTjhAVEJyNHnL2p7vc+wBDSdQuUpNw3M2u6xb9QsAY5Eg==", - "dev": true, - "requires": { - "chalk": "^2.0.1" - } - }, - "map-age-cleaner": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz", - "integrity": "sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w==", - "dev": true, - "requires": { - "p-defer": "^1.0.0" - } - }, - "markdown-it": { - "version": "8.4.2", - "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-8.4.2.tgz", - "integrity": "sha512-GcRz3AWTqSUphY3vsUqQSFMbgR38a4Lh3GWlHRh/7MRwz8mcu9n2IO7HOh+bXHrR9kOPDl5RNCaEsrneb+xhHQ==", - "dev": true, - "requires": { - "argparse": "^1.0.7", - "entities": "~1.1.1", - "linkify-it": "^2.0.0", - "mdurl": "^1.0.1", - "uc.micro": "^1.0.5" - } - }, - "mdurl": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz", - "integrity": "sha1-/oWy7HWlkDfyrf7BAP1sYBdhFS4=", - "dev": true - }, - "mem": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/mem/-/mem-4.3.0.tgz", - "integrity": "sha512-qX2bG48pTqYRVmDB37rn/6PT7LcR8T7oAX3bf99u1Tt1nzxYfxkgqDwUwolPlXweM0XzBOBFzSx4kfp7KP1s/w==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-3.0.0.tgz", + "integrity": "sha512-dSkNGuI7iG3mfvDzUuYZyvk5dD9ocYCYzNU6CYDE6+Xqd+gwme6Z00NS3dUh8mq/73HaEtT7m6W+yUPtU6BZnQ==", "dev": true, "requires": { - "map-age-cleaner": "^0.1.1", - "mimic-fn": "^2.0.0", - "p-is-promise": "^2.0.0" - }, - "dependencies": { - "mimic-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", - "dev": true - } + "chalk": "^2.4.2" } }, - "mime": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", - "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", - "dev": true - }, "mimic-fn": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", - "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", "dev": true }, "minimatch": { @@ -1149,28 +1176,29 @@ } }, "minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", "dev": true }, "mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", "dev": true, "requires": { - "minimist": "0.0.8" + "minimist": "^1.2.5" } }, "mocha": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-6.2.0.tgz", - "integrity": "sha512-qwfFgY+7EKAAUAdv7VYMZQknI7YJSGesxHyhn6qD52DV8UcSZs5XwCifcZGMVIE4a5fbmhvbotxC0DLQ0oKohQ==", + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-7.1.2.tgz", + "integrity": "sha512-o96kdRKMKI3E8U0bjnfqW4QMk12MwZ4mhdBTf+B5a1q9+aq2HRnj+3ZdJu0B/ZhJeK78MgYuv6L8d/rA5AeBJA==", "dev": true, "requires": { "ansi-colors": "3.2.3", "browser-stdout": "1.3.1", + "chokidar": "3.3.0", "debug": "3.2.6", "diff": "3.5.0", "escape-string-regexp": "1.0.5", @@ -1179,19 +1207,19 @@ "growl": "1.10.5", "he": "1.2.0", "js-yaml": "3.13.1", - "log-symbols": "2.2.0", + "log-symbols": "3.0.0", "minimatch": "3.0.4", - "mkdirp": "0.5.1", + "mkdirp": "0.5.5", "ms": "2.1.1", - "node-environment-flags": "1.0.5", + "node-environment-flags": "1.0.6", "object.assign": "4.1.0", "strip-json-comments": "2.0.1", "supports-color": "6.0.0", "which": "1.3.1", "wide-align": "1.1.3", - "yargs": "13.2.2", - "yargs-parser": "13.0.0", - "yargs-unparser": "1.5.0" + "yargs": "13.3.2", + "yargs-parser": "13.1.2", + "yargs-unparser": "1.6.0" }, "dependencies": { "debug": { @@ -1223,6 +1251,12 @@ "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", "dev": true }, + "strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "dev": true + }, "supports-color": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.0.0.tgz", @@ -1241,9 +1275,9 @@ "dev": true }, "mute-stream": { - "version": "0.0.7", - "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", - "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=", + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", + "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", "dev": true }, "natural-compare": { @@ -1259,37 +1293,33 @@ "dev": true }, "node-environment-flags": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/node-environment-flags/-/node-environment-flags-1.0.5.tgz", - "integrity": "sha512-VNYPRfGfmZLx0Ye20jWzHUjyTW/c+6Wq+iLhDzUI4XmhrDd9l/FozXV3F2xOaXjvp0co0+v1YSR3CMP6g+VvLQ==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/node-environment-flags/-/node-environment-flags-1.0.6.tgz", + "integrity": "sha512-5Evy2epuL+6TM0lCQGpFIj6KwiEsGh1SrHUhTbNX+sLbBtjidPZFAnVK9y5yU1+h//RitLbRHTIMyxQPtxMdHw==", "dev": true, "requires": { "object.getownpropertydescriptors": "^2.0.3", "semver": "^5.7.0" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } } }, - "npm-run-path": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", - "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", - "dev": true, - "requires": { - "path-key": "^2.0.0" - } - }, - "nth-check": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-1.0.2.tgz", - "integrity": "sha512-WeBOdju8SnzPN5vTUJYxYUxLeXpCaVP5i5e0LF8fg7WORF2Wd7wFX/pk0tYZk7s8T+J7VLy0Da6J1+wCT0AtHg==", - "dev": true, - "requires": { - "boolbase": "~1.0.0" - } + "normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true }, - "number-is-nan": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "object-inspect": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.7.0.tgz", + "integrity": "sha512-a7pEHdh1xKIAgTySUGgLMx/xwDZskN1Ud6egYYN3EdRW4ZMPNEDUTF+hwy2LUC+Bl+SyLXANnwz/jyh/qutKUw==", "dev": true }, "object-keys": { @@ -1311,13 +1341,13 @@ } }, "object.getownpropertydescriptors": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz", - "integrity": "sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY=", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.0.tgz", + "integrity": "sha512-Z53Oah9A3TdLoblT7VKJaTDdXdT+lQO+cNpKVnya5JDe9uLvzu1YyY1yFDFrcxrlRgWrEFH0jJtD/IbuwjcEVg==", "dev": true, "requires": { - "define-properties": "^1.1.2", - "es-abstract": "^1.5.1" + "define-properties": "^1.1.3", + "es-abstract": "^1.17.0-next.1" } }, "once": { @@ -1330,49 +1360,26 @@ } }, "onetime": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", - "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.0.tgz", + "integrity": "sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q==", "dev": true, "requires": { - "mimic-fn": "^1.0.0" + "mimic-fn": "^2.1.0" } }, "optionator": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", - "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=", + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", + "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", "dev": true, "requires": { "deep-is": "~0.1.3", - "fast-levenshtein": "~2.0.4", + "fast-levenshtein": "~2.0.6", "levn": "~0.3.0", "prelude-ls": "~1.1.2", "type-check": "~0.3.2", - "wordwrap": "~1.0.0" - } - }, - "os": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/os/-/os-0.1.1.tgz", - "integrity": "sha1-IIhF6J4ZOtTZcUdLk5R3NqVtE/M=", - "dev": true - }, - "os-homedir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", - "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", - "dev": true - }, - "os-locale": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-3.1.0.tgz", - "integrity": "sha512-Z8l3R4wYWM40/52Z+S265okfFj8Kt2cC2MKY+xNi3kFs+XGI7WXu/I309QQQYbRW4ijiZ+yxs9pqEhJh0DqW3Q==", - "dev": true, - "requires": { - "execa": "^1.0.0", - "lcid": "^2.0.0", - "mem": "^4.0.0" + "word-wrap": "~1.2.3" } }, "os-tmpdir": { @@ -1381,38 +1388,10 @@ "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", "dev": true }, - "osenv": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", - "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", - "dev": true, - "requires": { - "os-homedir": "^1.0.0", - "os-tmpdir": "^1.0.0" - } - }, - "p-defer": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz", - "integrity": "sha1-n26xgvbJqozXQwBKfU+WsZaw+ww=", - "dev": true - }, - "p-finally": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", - "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", - "dev": true - }, - "p-is-promise": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-2.1.0.tgz", - "integrity": "sha512-Y3W0wlRPK8ZMRbNq97l4M5otioeA5lm1z7bkNkxCka8HSPjR0xRWmpCmc9utiaLP9Jb1eD8BgeIxTW4AIF45Pg==", - "dev": true - }, "p-limit": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.1.tgz", - "integrity": "sha512-85Tk+90UCVWvbDavCLKPOLC9vvY8OwEX/RtKF+/1OADJMVlFfEHOiMTPVyxg7mk/dKa+ipdHm0OUkTvCpMTuwg==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", "dev": true, "requires": { "p-try": "^2.0.0" @@ -1442,24 +1421,6 @@ "callsites": "^3.0.0" } }, - "parse-semver": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/parse-semver/-/parse-semver-1.1.1.tgz", - "integrity": "sha1-mkr9bfBj3Egm+T+6SpnPIj9mbLg=", - "dev": true, - "requires": { - "semver": "^5.1.0" - } - }, - "parse5": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/parse5/-/parse5-3.0.3.tgz", - "integrity": "sha512-rgO9Zg5LLLkfJF9E6CCmXlSE4UVceloys8JrFqCcHloC3usd/kJCyPDwH2SOlzix2j3xaP9sUX3e8+kvkuleAA==", - "dev": true, - "requires": { - "@types/node": "*" - } - }, "path-exists": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", @@ -1472,22 +1433,21 @@ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, - "path-is-inside": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", - "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=", - "dev": true - }, "path-key": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", "dev": true }, - "pend": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", - "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=", + "php-parser": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/php-parser/-/php-parser-3.0.1.tgz", + "integrity": "sha512-m6CBPHOoMkzEHoXG0rhEg/VegSNemUNQepHnYtrRgTAh8rsqoO65KqQ32KJ5xe2iplhO0jdwd1UJ9Ea0yHsgYQ==" + }, + "picomatch": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", + "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==", "dev": true }, "prelude-ls": { @@ -1502,46 +1462,25 @@ "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", "dev": true }, - "pump": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", - "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", - "dev": true, - "requires": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, "punycode": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", "dev": true }, - "read": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/read/-/read-1.0.7.tgz", - "integrity": "sha1-s9oZvQUkMal2cdRKQmNK33ELQMQ=", - "dev": true, - "requires": { - "mute-stream": "~0.0.4" - } - }, - "readable-stream": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.5.0.tgz", - "integrity": "sha512-gSz026xs2LfxBPudDuI41V1lka8cxg64E66SGe78zJlsUofOg/yqwezdIcdfwik6B4h8LFmWPA9ef9X3FiNFLA==", + "readdirp": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.2.0.tgz", + "integrity": "sha512-crk4Qu3pmXwgxdSgGhgA/eXiJAPQiX4GMOZZMXnqKxHX7TaoL+3gQVo/WeuAiogr07DpnfjIMpXXa+PAIvwPGQ==", "dev": true, "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" + "picomatch": "^2.0.4" } }, "regexpp": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-2.0.1.tgz", - "integrity": "sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.1.0.tgz", + "integrity": "sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q==", "dev": true }, "require-directory": { @@ -1563,12 +1502,12 @@ "dev": true }, "restore-cursor": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", - "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", + "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", "dev": true, "requires": { - "onetime": "^2.0.0", + "onetime": "^5.1.0", "signal-exit": "^3.0.2" } }, @@ -1582,29 +1521,20 @@ } }, "run-async": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz", - "integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=", - "dev": true, - "requires": { - "is-promise": "^2.1.0" - } + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz", + "integrity": "sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==", + "dev": true }, "rxjs": { - "version": "6.5.3", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.3.tgz", - "integrity": "sha512-wuYsAYYFdWTAnAaPoKGNhfpWwKZbJW+HgAJ+mImp+Epl7BG8oNWBCTyRM8gba9k4lk8BgWdoYm21Mo/RYhhbgA==", + "version": "6.5.5", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.5.tgz", + "integrity": "sha512-WfQI+1gohdf0Dai/Bbmk5L5ItH5tYqm3ki2c5GdWhKjalzjg93N3avFjVStyZZz+A2Em+ZxKH5bNghw9UeylGQ==", "dev": true, "requires": { "tslib": "^1.9.0" } }, - "safe-buffer": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz", - "integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==", - "dev": true - }, "safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", @@ -1612,9 +1542,9 @@ "dev": true }, "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", "dev": true }, "set-blocking": { @@ -1639,9 +1569,9 @@ "dev": true }, "signal-exit": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", - "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", + "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", "dev": true }, "slice-ansi": { @@ -1653,6 +1583,14 @@ "ansi-styles": "^3.2.0", "astral-regex": "^1.0.0", "is-fullwidth-code-point": "^2.0.0" + }, + "dependencies": { + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + } } }, "sprintf-js": { @@ -1662,43 +1600,90 @@ "dev": true }, "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", + "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", "dev": true, "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + }, + "dependencies": { + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.0" + } + } } }, - "string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "string.prototype.trimend": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.1.tgz", + "integrity": "sha512-LRPxFUaTtpqYsTeNKaFOw3R4bxIzWOnbQ837QfBylo8jIxtcbK/A/sMV7Q+OAV/vWo+7s25pOE10KYSjaSO06g==", "dev": true, "requires": { - "safe-buffer": "~5.2.0" + "define-properties": "^1.1.3", + "es-abstract": "^1.17.5" } }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "string.prototype.trimleft": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/string.prototype.trimleft/-/string.prototype.trimleft-2.1.2.tgz", + "integrity": "sha512-gCA0tza1JBvqr3bfAIFJGqfdRTyPae82+KTnm3coDXkZN9wnuW3HjGgN386D7hfv5CHQYCI022/rJPVlqXyHSw==", "dev": true, "requires": { - "ansi-regex": "^3.0.0" + "define-properties": "^1.1.3", + "es-abstract": "^1.17.5", + "string.prototype.trimstart": "^1.0.0" } }, - "strip-eof": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", - "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", - "dev": true + "string.prototype.trimright": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/string.prototype.trimright/-/string.prototype.trimright-2.1.2.tgz", + "integrity": "sha512-ZNRQ7sY3KroTaYjRS6EbNiiHrOkjihL9aQE/8gfQ4DtAC/aEBRHFJa44OmoWxGGqXuJlfKkZW4WcXErGr+9ZFg==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.5", + "string.prototype.trimend": "^1.0.0" + } + }, + "string.prototype.trimstart": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.1.tgz", + "integrity": "sha512-XxZn+QpvrBI1FOcg6dIpxUPgWCPuNXvMD72aaRaUQv1eD4e/Qy8i/hFTe0BUmD60p/QA6bh1avmuPTfNjqVWRw==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.5" + } + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + } + } }, "strip-json-comments": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.0.tgz", + "integrity": "sha512-e6/d0eBu7gHtdCqFt0xJr642LdToM5/cN4Qb9DbHjVx1CP5RyeM+zH7pbecEmDv/lBqb0QH+6Uqq75rxFPkM0w==", "dev": true }, "supports-color": { @@ -1722,10 +1707,16 @@ "string-width": "^3.0.0" }, "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "emoji-regex": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", "dev": true }, "string-width": { @@ -1738,15 +1729,6 @@ "is-fullwidth-code-point": "^2.0.0", "strip-ansi": "^5.1.0" } - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, - "requires": { - "ansi-regex": "^4.1.0" - } } } }, @@ -1771,17 +1753,29 @@ "os-tmpdir": "~1.0.2" } }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + }, "tslib": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", - "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==", + "version": "1.11.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.11.2.tgz", + "integrity": "sha512-tTSkux6IGPnUGUd1XAZHcpu85MOkIl5zX49pO+jfsie3eP0B6pyhOlLXm3cAC6T7s+euSDDUUV+Acop5WmtkVg==", "dev": true }, - "tunnel": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.4.tgz", - "integrity": "sha1-LTeFoVjBdMmhbcLARuxfxfF0IhM=", - "dev": true + "tsutils": { + "version": "3.17.1", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.17.1.tgz", + "integrity": "sha512-kzeQ5B8H3w60nFY2g8cJIuH7JDpsALXySGtwGJ0p2LSjLgay3NdIpqq5SoOBe46bKDW2iq25irHCr8wjomUS2g==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + } }, "type-check": { "version": "0.3.2", @@ -1792,32 +1786,16 @@ "prelude-ls": "~1.1.2" } }, - "typed-rest-client": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/typed-rest-client/-/typed-rest-client-1.2.0.tgz", - "integrity": "sha512-FrUshzZ1yxH8YwGR29PWWnfksLEILbWJydU7zfIRkyH7kAEzB62uMAl2WY6EyolWpLpVHeJGgQm45/MaruaHpw==", - "dev": true, - "requires": { - "tunnel": "0.0.4", - "underscore": "1.8.3" - } - }, - "typescript": { - "version": "3.6.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.6.3.tgz", - "integrity": "sha512-N7bceJL1CtRQ2RiG0AQME13ksR7DiuQh/QehubYcghzv20tnh+MQnQIuJddTmsbqYj+dztchykemz0zFzlvdQw==", + "type-fest": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", "dev": true }, - "uc.micro": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz", - "integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==", - "dev": true - }, - "underscore": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", - "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=", + "typescript": { + "version": "3.8.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.8.3.tgz", + "integrity": "sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==", "dev": true }, "uri-js": { @@ -1829,65 +1807,20 @@ "punycode": "^2.1.0" } }, - "url-join": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/url-join/-/url-join-1.1.0.tgz", - "integrity": "sha1-dBxsL0WWxIMNZxhGCSDQySIC3Hg=", + "v8-compile-cache": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.0.tgz", + "integrity": "sha512-usZBT3PW+LOjM25wbqIlZwPeJV+3OSz3M1k1Ws8snlW39dZyYL9lOGC5FgPVHfk0jKmjiDV8Z0mIbVQPiwFs7g==", "dev": true }, - "util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", - "dev": true - }, - "vsce": { - "version": "1.73.0", - "resolved": "https://registry.npmjs.org/vsce/-/vsce-1.73.0.tgz", - "integrity": "sha512-6W37Ebbkj3uF3WhT+SCfRtsneRQEFcGvf/XYz+b6OAgDCj4gPurWyDVrqw/HLsbP1WflGIyUfVZ8t5M7kQp6Uw==", - "dev": true, - "requires": { - "azure-devops-node-api": "^7.2.0", - "chalk": "^2.4.2", - "cheerio": "^1.0.0-rc.1", - "commander": "^2.8.1", - "denodeify": "^1.2.1", - "didyoumean": "^1.2.1", - "glob": "^7.0.6", - "lodash": "^4.17.10", - "markdown-it": "^8.3.1", - "mime": "^1.3.4", - "minimatch": "^3.0.3", - "osenv": "^0.1.3", - "parse-semver": "^1.1.1", - "read": "^1.0.7", - "semver": "^5.1.0", - "tmp": "0.0.29", - "typed-rest-client": "1.2.0", - "url-join": "^1.1.0", - "yauzl": "^2.3.1", - "yazl": "^2.2.2" - }, - "dependencies": { - "tmp": { - "version": "0.0.29", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.29.tgz", - "integrity": "sha1-8lEl/w3Z2jzLDC3Tce4SiLuRKMA=", - "dev": true, - "requires": { - "os-tmpdir": "~1.0.1" - } - } - } - }, "vscode-test": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/vscode-test/-/vscode-test-1.2.0.tgz", - "integrity": "sha512-aowqgc8gZe0eflzVUXsBjBrlsJ8eC35kfgfSEeHu9PKA1vQKm/3rVK43TlbxGue8hKtZBElNAJ5QuYklR/vLJA==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/vscode-test/-/vscode-test-1.3.0.tgz", + "integrity": "sha512-LddukcBiSU2FVTDr3c1D8lwkiOvwlJdDL2hqVbn6gIz+rpTqUCkMZSKYm94Y1v0WXlHSDQBsXyY+tchWQgGVsw==", "dev": true, "requires": { "http-proxy-agent": "^2.1.0", - "https-proxy-agent": "^2.2.1", + "https-proxy-agent": "^2.2.4", "rimraf": "^2.6.3" } }, @@ -1913,57 +1846,79 @@ "dev": true, "requires": { "string-width": "^1.0.2 || 2" - } - }, - "wordwrap": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", - "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", - "dev": true - }, - "wrap-ansi": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", - "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", - "dev": true, - "requires": { - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1" }, "dependencies": { "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", "dev": true }, "is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", "dev": true, "requires": { - "number-is-nan": "^1.0.0" + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" } }, - "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", "dev": true, "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" + "ansi-regex": "^3.0.0" } + } + } + }, + "word-wrap": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "dev": true + }, + "wrap-ansi": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", + "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.0", + "string-width": "^3.0.0", + "strip-ansi": "^5.0.0" + }, + "dependencies": { + "emoji-regex": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "dev": true }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", "dev": true, "requires": { - "ansi-regex": "^2.0.0" + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" } } } @@ -1990,28 +1945,33 @@ "dev": true }, "yargs": { - "version": "13.2.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.2.2.tgz", - "integrity": "sha512-WyEoxgyTD3w5XRpAQNYUB9ycVH/PQrToaTXdYXRdOXvEy1l19br+VJsc0vcO8PTGg5ro/l/GY7F/JMEBmI0BxA==", + "version": "13.3.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", + "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==", "dev": true, "requires": { - "cliui": "^4.0.0", + "cliui": "^5.0.0", "find-up": "^3.0.0", "get-caller-file": "^2.0.1", - "os-locale": "^3.1.0", "require-directory": "^2.1.1", "require-main-filename": "^2.0.0", "set-blocking": "^2.0.0", "string-width": "^3.0.0", "which-module": "^2.0.0", "y18n": "^4.0.0", - "yargs-parser": "^13.0.0" + "yargs-parser": "^13.1.2" }, "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "emoji-regex": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", "dev": true }, "string-width": { @@ -2024,22 +1984,13 @@ "is-fullwidth-code-point": "^2.0.0", "strip-ansi": "^5.1.0" } - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, - "requires": { - "ansi-regex": "^4.1.0" - } } } }, "yargs-parser": { - "version": "13.0.0", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.0.0.tgz", - "integrity": "sha512-w2LXjoL8oRdRQN+hOyppuXs+V/fVAYtpcrRxZuF7Kt/Oc+Jr2uAcVntaUTNT6w5ihoWfFDpNY8CPx1QskxZ/pw==", + "version": "13.1.2", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz", + "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==", "dev": true, "requires": { "camelcase": "^5.0.0", @@ -2047,77 +1998,14 @@ } }, "yargs-unparser": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-1.5.0.tgz", - "integrity": "sha512-HK25qidFTCVuj/D1VfNiEndpLIeJN78aqgR23nL3y4N0U/91cOAzqfHlF8n2BvoNDcZmJKin3ddNSvOxSr8flw==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-1.6.0.tgz", + "integrity": "sha512-W9tKgmSn0DpSatfri0nx52Joq5hVXgeLiqR/5G0sZNDoLZFOr/xjBUDcShCOGNsBnEMNo1KAMBkTej1Hm62HTw==", "dev": true, "requires": { "flat": "^4.1.0", - "lodash": "^4.17.11", - "yargs": "^12.0.5" - }, - "dependencies": { - "get-caller-file": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", - "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==", - "dev": true - }, - "require-main-filename": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", - "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", - "dev": true - }, - "yargs": { - "version": "12.0.5", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-12.0.5.tgz", - "integrity": "sha512-Lhz8TLaYnxq/2ObqHDql8dX8CJi97oHxrjUcYtzKbbykPtVW9WB+poxI+NM2UIzsMgNCZTIf0AQwsjK5yMAqZw==", - "dev": true, - "requires": { - "cliui": "^4.0.0", - "decamelize": "^1.2.0", - "find-up": "^3.0.0", - "get-caller-file": "^1.0.1", - "os-locale": "^3.0.0", - "require-directory": "^2.1.1", - "require-main-filename": "^1.0.1", - "set-blocking": "^2.0.0", - "string-width": "^2.0.0", - "which-module": "^2.0.0", - "y18n": "^3.2.1 || ^4.0.0", - "yargs-parser": "^11.1.1" - } - }, - "yargs-parser": { - "version": "11.1.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-11.1.1.tgz", - "integrity": "sha512-C6kB/WJDiaxONLJQnF8ccx9SEeoTTLek8RVbaOIsrAUS8VrBEXfmeSnCZxygc+XC2sNMBIwOOnfcxiynjHsVSQ==", - "dev": true, - "requires": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - } - } - } - }, - "yauzl": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", - "integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=", - "dev": true, - "requires": { - "buffer-crc32": "~0.2.3", - "fd-slicer": "~1.1.0" - } - }, - "yazl": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/yazl/-/yazl-2.5.1.tgz", - "integrity": "sha512-phENi2PLiHnHb6QBVot+dJnaAZ0xosj7p3fWl+znIjBDlnMI2PsZCJZ306BPTFOaHf5qdDEI8x5qFrSOBN5vrw==", - "dev": true, - "requires": { - "buffer-crc32": "~0.2.3" + "lodash": "^4.17.15", + "yargs": "^13.3.0" } } } diff --git a/package.json b/package.json index 2c29329..0cce785 100644 --- a/package.json +++ b/package.json @@ -1,31 +1,32 @@ { "name": "php-add-property", "displayName": "PHP Add Property", - "description": "Quick way to add PHP class properties", + "description": "Manage PHP class properties", "publisher": "kotfire", "license": "SEE LICENSE IN LICENSE", - "version": "0.4.1", + "version": "1.1.0", "engines": { - "vscode": "^1.38.0" + "vscode": "^1.31.0" }, "categories": [ "Programming Languages", - "Snippets" + "Snippets", + "Formatters" ], "keywords": [ "php", "autocompletion", - "help", + "refactor", "constructor", - "property" + "property", + "class", + "help" ], "icon": "images/icon.png", "activationEvents": [ - "onLanguage:php", - "onCommand:phpAddProperty.add", - "onCommand:phpAddProperty.append" + "*" ], - "main": "./src/extension.js", + "main": "./out/extension.js", "contributes": { "commands": [ { @@ -35,27 +36,87 @@ { "command": "phpAddProperty.append", "title": "Add Existing PHP Property" + }, + { + "command": "phpAddProperty.rename", + "title": "Rename PHP Property" + }, + { + "command": "phpAddProperty.changeType", + "title": "Change PHP Property type" + }, + { + "command": "phpAddProperty.remove", + "title": "Remove Existing PHP Property" + }, + { + "command": "phpAddProperty.breakConstructorIntoMultiline", + "title": "Break Constructor Into Multiline" } ], "menus": { "commandPalette": [ + { + "command": "phpAddProperty.add", + "when": "editorLangId == php" + }, { "command": "phpAddProperty.append", "when": "editorLangId == php" + }, + { + "command": "phpAddProperty.rename", + "when": "editorLangId == php" + }, + { + "command": "phpAddProperty.changeType", + "when": "editorLangId == php" + }, + { + "command": "phpAddProperty.remove", + "when": "editorLangId == php" + }, + { + "command": "phpAddProperty.breakConstructorIntoMultiline", + "when": "editorLangId == php" } ], "editor/context": [ { - "when": "resourceLangId == php && config.phpAddProperty.showContextMenuOptions", + "when": "resourceLangId == php && config.phpAddProperty.contextMenuOptions.enable && config.phpAddProperty.contextMenuOptions.addProperty", "command": "phpAddProperty.add", "alt": "phpAddProperty.add", "group": "0_phpAddProperty@1" }, { - "when": "resourceLangId == php && config.phpAddProperty.showContextMenuOptions", + "when": "resourceLangId == php && config.phpAddProperty.contextMenuOptions.enable && config.phpAddProperty.contextMenuOptions.appendProperty", "command": "phpAddProperty.append", "alt": "phpAddProperty.append", "group": "0_phpAddProperty@2" + }, + { + "when": "resourceLangId == php && config.phpAddProperty.contextMenuOptions.enable && config.phpAddProperty.contextMenuOptions.renameProperty", + "command": "phpAddProperty.rename", + "alt": "phpAddProperty.rename", + "group": "0_phpAddProperty@3" + }, + { + "when": "resourceLangId == php && config.phpAddProperty.contextMenuOptions.enable && config.phpAddProperty.contextMenuOptions.changePropertyType", + "command": "phpAddProperty.changeType", + "alt": "phpAddProperty.changeType", + "group": "0_phpAddProperty@4" + }, + { + "when": "resourceLangId == php && config.phpAddProperty.contextMenuOptions.enable && config.phpAddProperty.contextMenuOptions.removeProperty", + "command": "phpAddProperty.remove", + "alt": "phpAddProperty.remove", + "group": "0_phpAddProperty@5" + }, + { + "when": "resourceLangId == php && config.phpAddProperty.contextMenuOptions.enable && config.phpAddProperty.contextMenuOptions.breakConstructorIntoMultiline", + "command": "phpAddProperty.breakConstructorIntoMultiline", + "alt": "phpAddProperty.breakConstructorIntoMultiline", + "group": "0_phpAddProperty@6" } ] }, @@ -158,28 +219,72 @@ "default": false, "description": "Specifies whether to show messages on status bar instead of notification box" }, - "phpAddProperty.showContextMenuOptions": { + "phpAddProperty.contextMenuOptions.enable": { "type": "boolean", "default": false, "description": "Specifies whether to show the context menu options" + }, + "phpAddProperty.contextMenuOptions.addProperty": { + "type": "boolean", + "default": true, + "description": "Specifies whether to show the add property command in the context menu options" + }, + "phpAddProperty.contextMenuOptions.appendProperty": { + "type": "boolean", + "default": true, + "description": "Specifies whether to show the append property command in the context menu options" + }, + "phpAddProperty.contextMenuOptions.renameProperty": { + "type": "boolean", + "default": true, + "description": "Specifies whether to show the rename property command in the context menu options" + }, + "phpAddProperty.contextMenuOptions.changePropertyType": { + "type": "boolean", + "default": true, + "description": "Specifies whether to show the change property type command in the context menu options" + }, + "phpAddProperty.contextMenuOptions.removeProperty": { + "type": "boolean", + "default": true, + "description": "Specifies whether to show the remove property command in the context menu options" + }, + "phpAddProperty.contextMenuOptions.breakConstructorIntoMultiline": { + "type": "boolean", + "default": true, + "description": "Specifies whether to show the break constructor into multiline command in the context menu options" + }, + "phpAddProperty.showVersionUpdates": { + "type": "boolean", + "default": true, + "description": "Specifies whether to show What's New after upgrading to a new version" } } } }, "scripts": { - "test": "node ./test/runTest.js" + "vscode:prepublish": "npm run compile", + "compile": "tsc -p ./", + "lint": "eslint src --ext ts", + "watch": "tsc -watch -p ./", + "pretest": "npm run compile", + "test": "node ./out/test/runTest.js" + }, + "dependencies": { + "php-parser": "^3.0.1" }, "devDependencies": { "@types/glob": "^7.1.1", - "@types/mocha": "^5.2.6", - "@types/node": "^10.12.21", - "@types/vscode": "^1.38.0", - "eslint": "^5.13.0", - "glob": "^7.1.4", - "mocha": "^6.1.4", - "typescript": "^3.3.1", - "vsce": "^1.73.0", - "vscode-test": "^1.2.0" + "@types/mocha": "^7.0.2", + "@types/node": "^13.11.0", + "@types/vscode": "1.31.0", + "@typescript-eslint/eslint-plugin": "^2.30.0", + "@typescript-eslint/parser": "^2.30.0", + "eslint": "^6.8.0", + "glob": "^7.1.6", + "mocha": "^7.1.2", + "typescript": "^3.8.3", + "vscode-test": "^1.3.0" }, "repository": { "type": "git", diff --git a/src/AddProperty.js b/src/AddProperty.js deleted file mode 100644 index 59de52e..0000000 --- a/src/AddProperty.js +++ /dev/null @@ -1,660 +0,0 @@ -const vscode = require('vscode'); - -class AddProperty { - async add() { - this.reset(); - const document = this.activeEditor().document; - - if (document.uri === undefined) { - return; - } - - this.parseDocument(document); - - if (!this.classLine) { - return; - } - - this.name = await vscode.window.showInputBox({ - placeHolder: 'Enter the property name' - }); - - if (this.name === undefined || this.name.trim() === "") { - return; - } - - if (!this.constructorStartLine) { - this.insertConstructor(); - } else { - this.insertProperty(); - } - } - - async append() { - this.reset(); - const document = this.activeEditor().document; - - if (document.uri === undefined) { - return; - } - - this.parseDocument(document); - - if (!this.classLine) { - return; - } - - const editor = this.activeEditor(); - const selectionLineNumber = editor.selection.active.line; - const line = document.lineAt(selectionLineNumber); - - if (!this.isPropertyLine(line.text)) { - return; - } - - const match = /\$([^\s;]*)/.exec(line.text); - - if (!match[1]) { - return; - } - - this.name = match[1]; - - if (this.name === undefined || this.name.trim() === "") { - return; - } - - let previousLineNumber = selectionLineNumber - 1; - - if (previousLineNumber > 0) { - let previousLine = editor.document.lineAt(previousLineNumber); - - if (/\*\//.test(previousLine.text)) { - for (previousLineNumber; previousLineNumber > 0; previousLineNumber--) { - previousLine = document.lineAt(previousLineNumber); - const typeMatch = /@var\s(\S*)/.exec(previousLine.text); - - if (typeMatch) { - this.type = typeMatch[1]; - } - - if (/\/\*\*/.test(previousLine.text)) { - break; - } - } - } - } - - if (! /function __construct/gm.test(this.activeEditor().document.getText())) { - this.insertConstructor(false); - } else { - this.insertProperty(false); - } - } - - insertConstructor(shouldInsertPropertyStatement = true) { - let insertLine = this.classLine; - - if (this.lastTraitLine) { - insertLine = this.lastTraitLine; - } - - if (this.lastPropertyLine) { - insertLine = this.lastPropertyLine; - } - - let snippet = this.escapeForSnippet(this.activeEditor().document.getText(insertLine.range)) + "\n"; - - if (this.lastTraitLine || this.lastPropertyLine) { - snippet += "\n"; - } - - if (shouldInsertPropertyStatement === true && !this.classProperties.includes(this.name)) { - snippet += this.indentText(this.getPropertyStatementText()); - } - - if (this.config('phpAddProperty.constructor.docblock.enable') === true) { - snippet += this.indentText("/**\n") - + this.indentText(" * Constructor.\n") - + this.indentText(`${this.getConstructorParamDocblockText()}\n`) - + this.indentText(" */\n") - } - - const visibility = this.config('phpAddProperty.constructor.visibility.default'); - let constructorText = this.indentText( - this.config('phpAddProperty.constructor.visibility.choose') === true - ? `\${${this.tabStops.constructorVisibility}${this.getVisibilityChoice(visibility)}} ` - : `${visibility} ` - ); - - const parameterText = this.getParameterText(); - - constructorText += `function __construct(${parameterText})\n` - + this.indentText('{\n') - + this.indentText(`\\$this->${this.name} = \\$${this.name};\$0\n`, 2) - + this.indentText('}'); - - snippet += constructorText; - - let range = insertLine.range; - - for (let nextLineNumber = insertLine.range.end.line + 1; nextLineNumber < this.activeEditor().document.lineCount; nextLineNumber++) { - const nextLine = this.activeEditor().document.lineAt(nextLineNumber); - - if (!nextLine.isEmptyOrWhitespace) { - if (!/}/.test(nextLine.text)) { - snippet += "\n"; - } - break; - } - - range = new vscode.Range( - range.start, - nextLine.range.end - ); - } - - this.replaceWithSnippet(snippet, range); - } - - insertProperty(shouldInsertPropertyStatement = true) { - let text = shouldInsertPropertyStatement === true && !this.classProperties.includes(this.name) - ? this.indentText(this.getPropertyStatementText()) - : ''; - - let constructorText = this.escapeForSnippet( - this.activeEditor().document.getText( - new vscode.Range( - this.constructorStartLine.range.start, - this.constructorEndLine.rangeIncludingLineBreak.start - ) - ) - ); - - // Update docblock parameters - const shouldUpdateDocblockParameters = this.config('phpAddProperty.constructor.docblock.enable') === true - && this.constructorDocblockStartLine - && !this.docblockParams.includes(this.name); - - if (shouldUpdateDocblockParameters) { - let docblockText = this.escapeForSnippet( - this.activeEditor().document.getText( - new vscode.Range( - this.constructorDocblockStartLine.range.start, - this.constructorDocblockEndLine.rangeIncludingLineBreak.start - ) - ) - ); - - const newDocblockText = docblockText - + this.indentText( - this.getConstructorParamDocblockText(), - this.calculateIndentationLevel( - this.getLineFirstNonIndentationCharacterIndex(this.constructorDocblockStartLine) - ) - ) - + "\n"; - - constructorText = constructorText.replace(docblockText, newDocblockText); - } - - // Check if property already exists as argument - const constructorMatch = /function\s+__construct\s*\(((?:\s|\S)*)(?=\))\s*\)/.exec(constructorText); - if (constructorMatch) { - const parametersText = constructorMatch[1]; - const parameters = parametersText.split(',').flatMap(parameter => { - const match = parameter.trim().match(/\$(\S+)/); - return match ? [match[1]] : []; - }); - - if (parameters.includes(this.name)) { - this.showErrorMessage('Property already exists as constructor argument'); - - return; - } - } - - // Check if property has been already assignated - let propertyAssignationExists = false; - const assignationRegex = /\$this->(\S+)\s*=[^;]*;/g; - let assignationMatch; - while (assignationMatch = assignationRegex.exec(constructorText)) { - if (assignationMatch[1] === this.name) { - propertyAssignationExists = true; - break; - } - } - - // Add property to constructor parameters - const constructorParameterLastLine = this.constructorLastParameterLine || this.constructorParametersCloseLine; - const constructorLastParameterText = this.escapeForSnippet( - this.activeEditor().document.getText(constructorParameterLastLine.range) - ); - - let position = constructorParameterLastLine.range.end.character; - if (constructorParameterLastLine.lineNumber === this.constructorParametersCloseLine.lineNumber) { - const match = /\)(?!\))/.exec(constructorLastParameterText); - if (match) { - position = match.index - 1; - } - } - - // Zero-based to one-based - position++; - - const newParameterText = this.getParameterText(); - let newParameterWrapper = this.constructorLastParameterLine ? ',' : ''; - if (this.isMultiLineConstructor) { - newParameterWrapper += "\n" + this.indentText( - newParameterText, - this.calculateIndentationLevel( - this.getLineFirstNonIndentationCharacterIndex(constructorParameterLastLine) - ) - ); - } else { - newParameterWrapper += (this.constructorLastParameterLine ? ' ' : '') + newParameterText; - } - - const output = [ - constructorLastParameterText.slice(0, position), - newParameterWrapper, - constructorLastParameterText.slice(position) - ].join(''); - - constructorText = constructorText.replace(constructorLastParameterText, output); - - if (!this.isMultiLineConstructor) { - constructorText = this.breakIntoMultiline(constructorText); - } - - text += constructorText; - - if (!propertyAssignationExists) { - // Initialize property to parameter - text += this.indentText(`\\$this->${this.name} = \\$${this.name};\$0\n`, 2); - } - - // Close constructor - text += this.constructorEndLine.text; - - const range = new vscode.Range( - this.constructorStartLine.range.start, - this.constructorEndLine.range.end - ); - - this.replaceWithSnippet(text, range); - } - - breakIntoMultiline(constructorText) { - if (this.config('phpAddProperty.constructor.breakIntoMultilineIfLengthExceeded.enabled') === true) { - const regex = /((public|protected|private)\s+function\s+__construct\s*\(((?:\s|\S)*)(?=\))\s*\))\s*{/; - const match = regex.exec(constructorText); - if (match) { - const constructorLineText = match[1]; - - if (constructorLineText.length > this.config('phpAddProperty.constructor.breakIntoMultilineIfLengthExceeded.maxLineLength')) { - const visibilityText = match[2]; - const parametersText = match[3]; - const parameters = parametersText.split(',').map(parameter => this.indentText(parameter.trim(), 2)); - - const multilineConstructorText = `${visibilityText} function __construct(\n` - + `${parameters.join(',\n')}\n` - + this.indentText(') {'); - - constructorText = constructorText.replace(match[0], multilineConstructorText); - } - } - } - - return constructorText; - } - - indentText(text, level = 1) { - /** - * Good to have - * Listen for view options changes and use these values - * https://github.com/jedmao/tabsanity-vs/blob/faa41a99ccb47c8e7717edfcbdfba4c093e670fe/TabSanity/TabOptionsListener.cs - */ - let tab = "\t"; - if (this.configUsingResource('editor.insertSpaces')) { - const tabSize = this.configUsingResource('editor.tabSize'); - tab = ' '.repeat(tabSize); - } - return tab.repeat(level) + text; - } - - getVisibilityChoice(defaultValue) { - let visibilityChoices = ['public', 'protected', 'private']; - if (visibilityChoices.indexOf(defaultValue) !== -1) { - visibilityChoices.splice(visibilityChoices.indexOf(defaultValue), 1); - } - return `|${[defaultValue, ...visibilityChoices].join(',')}|`; - } - - getPropertyStatementText() { - let docblockTypeStop = this.tabStops.propertyDocblockType; - let dockblockImportStop = this.tabStops.propertyDocblockImport; - - if (this.config('phpAddProperty.property.docblock.withParameter') === true) { - docblockTypeStop = this.tabStops.constructorParameterType; - dockblockImportStop = this.tabStops.constructorParameterStop; - this.tabStops.constructorParameterStop++; - } - - let propertyStatementText = ''; - if (this.config('phpAddProperty.property.docblock.add') === true) { - let stopText = ''; - - if (this.config('phpAddProperty.property.docblock.stopToImport') === true) { - stopText += `$${dockblockImportStop}`; - } - - stopText += `$${docblockTypeStop}`; - - if (this.config('phpAddProperty.property.docblock.multiline') === true) { - propertyStatementText += `/**\n${this.indentText(' * @var ')}${stopText}\n${this.indentText(' */')}\n${this.indentText('')}`; - } else { - if (this.config('phpAddProperty.property.docblock.withParameter') === false) { - stopText += ' '; - } - - propertyStatementText += `/** @var ${stopText}*/\n${this.indentText('')}`; - } - } - - const visibility = this.config('phpAddProperty.property.visibility.default'); - propertyStatementText += this.config('phpAddProperty.property.visibility.choose') === true - ? `\${${this.tabStops.propertyVisibility}${this.getVisibilityChoice(visibility)}} ` - : `${visibility} `; - - if (this.config('phpAddProperty.property.types') === true) { - propertyStatementText += `$${this.tabStops.constructorParameterType}`; - } - propertyStatementText += `\\$${this.name};\n\n`; - - return propertyStatementText; - } - - getConstructorParamDocblockText() { - let docblockTypeStop = this.tabStops.constructorDocblockType; - let dockblockImportStop = this.tabStops.constructorDocblockImport; - - if (this.config('phpAddProperty.constructor.docblock.withParameter') === true) { - docblockTypeStop = this.tabStops.constructorParameterType; - dockblockImportStop = this.tabStops.constructorParameterStop; - this.tabStops.constructorParameterStop++; - } - - let constructorParamDocblockText = `\${${docblockTypeStop}}`; - - if (this.type) { - constructorParamDocblockText = `\${${docblockTypeStop}:${this.type} }`; - } - - if (this.config('phpAddProperty.constructor.docblock.stopToImport') === true) { - constructorParamDocblockText += `\$${dockblockImportStop}`; - } - - constructorParamDocblockText += `\\$${this.name}`; - - if (this.config('phpAddProperty.constructor.docblock.stopForDescription') === true) { - constructorParamDocblockText += `\$${this.tabStops.constructorDocblockDescription}`; - } - - return ` * @param ${constructorParamDocblockText}`; - } - - getParameterText() { - let tabStopsText = `$${this.tabStops.constructorParameterType}`; - - if (this.type) { - tabStopsText = `\${${this.tabStops.constructorParameterType}:${this.type}}`; - } - - if (this.config('phpAddProperty.property.stopToImport') === true) { - tabStopsText += `$${this.tabStops.constructorParameterStop}`; - } - - let parameterText = `${tabStopsText}`; - - if (this.type) { - parameterText += ' '; - } - - parameterText += `\\$${this.name}`; - - return parameterText; - } - - isPropertyLine(textLine) { - return /(public|protected|private|static)\s+\$\w+.*;/.test(textLine); - } - - replaceWithSnippet(text, range) { - const rangeLines = range.end.line - range.start.line; - - this.activeEditor().edit( - editBuilder => { - editBuilder.replace(range, "\n".repeat(rangeLines)) - }, - { - undoStopBefore: false, - undoStopAfter: false - } - ); - - this.activeEditor().insertSnippet( - new vscode.SnippetString(text), - range, - { - undoStopBefore: false, - undoStopAfter: false - } - ); - } - - getLineFirstNonIndentationCharacterIndex(line) { - const tabSize = this.configUsingResource('editor.tabSize'); - - let index = 0; - for (let i = 0; i < line.text.length; i++) { - const char = line.text[i]; - - if (/[^\s\t]/.test(char)) { - index++; - break; - } - - index += char === "\t" ? tabSize : 1; - } - - return index; - } - - getLineTextFromFirstNonIndentationCharacter(line) { - let i = 0; - - for (i; i < line.text.length; i++) { - if (/[^\s\t]/.test(line.text[i])) { - break; - } - } - - return line.text.substr(i); - } - - calculateIndentationLevel(index) { - return Math.floor(index / this.configUsingResource('editor.tabSize')); - } - - escapeForSnippet(text) { - return text.replace(/(? 0) { - let previousLine = document.lineAt(previousLineNumber); - - if (/^\*\//.test(this.getLineTextFromFirstNonIndentationCharacter(previousLine))) { - this.constructorDocblockEndLine = previousLine; - let paramLine; - - for (previousLineNumber--; previousLineNumber > 0; previousLineNumber--) { - previousLine = document.lineAt(previousLineNumber); - paramLine = /@param(?:\s+\S+)\s+\$(\S+)/.exec(previousLine.text); - - if (paramLine) { - this.docblockParams.push(paramLine[1]); - this.lastDocBlockParamLine = previousLine; - } - - if (/^\/\*\*/.test(this.getLineTextFromFirstNonIndentationCharacter(previousLine))) { - this.constructorDocblockStartLine = previousLine; - this.constructorStartLine = previousLine; - break; - } - } - } - } - - for (let ln = lineNumber; ln < document.lineCount; ln++) { - const l = document.lineAt(ln); - const tl = l.text; - - if (/\$\w+/.test(tl)) { - this.constructorLastParameterLine = l; - } - - if (/\)(?!\))/.test(tl)) { - this.constructorParametersCloseLine = l; - } - - if (/{/.test(tl)) { - this.isMultiLineConstructor = this.constructorParametersCloseLine.lineNumber !== lineNumber; - break; - } - } - - - for (let nextLineNumber = lineNumber + 1; nextLineNumber < document.lineCount; nextLineNumber++) { - const nextLine = document.lineAt(nextLineNumber); - if (/^}/.test(this.getLineTextFromFirstNonIndentationCharacter(nextLine))) { - this.constructorEndLine = nextLine; - break; - } - } - } - } - } -} - -module.exports = AddProperty; \ No newline at end of file diff --git a/src/addPropertyStatement.ts b/src/addPropertyStatement.ts new file mode 100644 index 0000000..78c2c2b --- /dev/null +++ b/src/addPropertyStatement.ts @@ -0,0 +1,103 @@ +import * as vscode from 'vscode'; +import Class from './class'; +import Property from './property'; +import { escapeForSnippet, indentText, calculateIndentationLevel, getLineFirstNonIndentationCharacterIndex } from './utils'; + +export default function addPropertyStatement(document: vscode.TextDocument, phpClass: Class, property: Property, tabStops: any): string { + const phpClassRange = new vscode.Range( + new vscode.Position(phpClass.ast.loc.start.line - 1, phpClass.ast.loc.start.column), + new vscode.Position(phpClass.ast.loc.end.line - 1, phpClass.ast.loc.end.column) + ); + + let newDocumentText = escapeForSnippet(document.getText(phpClassRange)); + + let lastProperty; + let firstMethod; + let lastNode; + + const astClassBody = phpClass.ast.body; + for (let i = 0; i < astClassBody.length; i++) { + const node = astClassBody[i]; + + lastNode = node; + + if (node.kind === 'propertystatement') { + lastProperty = node; + + // Check that property does not already exist + for (let j = 0; j < node.properties.length; j++) { + const propertyNode = node.properties[j]; + + if (propertyNode.name?.name === property.getName()) { + return newDocumentText; + } + } + } else if (!firstMethod && node.kind === 'method' && node.name !== '__construct') { + firstMethod = node; + } + } + + const propertyStatementText = property.getStatementText(tabStops); + + if (lastProperty) { + const lastPropertyLine = document.lineAt(lastProperty.loc.start.line - 1); + + const newPropertyText = escapeForSnippet(`${lastPropertyLine.text}`) + "\n\n" + indentText( + propertyStatementText, + calculateIndentationLevel( + getLineFirstNonIndentationCharacterIndex(lastPropertyLine.text) + ) + ); + + newDocumentText = newDocumentText.replace(escapeForSnippet(lastPropertyLine.text), newPropertyText); + } else if (firstMethod) { + const firstMethodLine = document.lineAt(firstMethod.loc.start.line - 1); + + const newPropertyText = indentText( + propertyStatementText, + calculateIndentationLevel( + getLineFirstNonIndentationCharacterIndex(firstMethodLine.text) + ) + ) + "\n\n" + escapeForSnippet(firstMethodLine.text); + + newDocumentText = newDocumentText.replace(escapeForSnippet(firstMethodLine.text), newPropertyText); + } else if (lastNode) { + const lastNodeLine = document.lineAt(lastNode.loc.start.line - 1); + + const newPropertyText = escapeForSnippet(lastNodeLine.text) + "\n\n" + indentText( + propertyStatementText, + calculateIndentationLevel( + getLineFirstNonIndentationCharacterIndex(lastNodeLine.text) + ) + ); + + newDocumentText = newDocumentText.replace(escapeForSnippet(lastNodeLine.text), newPropertyText); + } else { + const isOneLineClass = phpClass.ast.loc.start.line === phpClass.ast.loc.end.line; + + if (isOneLineClass) { + const match = phpClass.ast.loc.source.match(/(.*)\}/); + + const newPropertyText = escapeForSnippet(match[1]) + "\n" + indentText( + propertyStatementText, + 1 + ) + "\n" + '}'; + + newDocumentText = newDocumentText.replace(escapeForSnippet(phpClass.ast.loc.source), newPropertyText); + } else { + const classBodyLine = document.lineAt(phpClass.ast.loc.start.line - 1); + const classText = escapeForSnippet(phpClass.ast.loc.source); + + const newPropertyText = classText.replace(/{(?:\s|[\r\n]|\s)*}/, "{\n" + indentText( + propertyStatementText, + calculateIndentationLevel( + getLineFirstNonIndentationCharacterIndex(classBodyLine.text) + ) + 1 + )) + "\n}"; + + newDocumentText = newDocumentText.replace(classText, newPropertyText); + } + } + + return newDocumentText; +} diff --git a/src/changePropertyType.ts b/src/changePropertyType.ts new file mode 100644 index 0000000..4575ed4 --- /dev/null +++ b/src/changePropertyType.ts @@ -0,0 +1,129 @@ +import * as vscode from 'vscode'; +import Property from './property'; +import Class from './class'; +import { config, escapeForRegExp } from './utils'; + +export function changePropertyType(editor: vscode.TextEditor, property: Property, newPropertyType: string, phpClass: Class) { + const document = editor.document; + const phpClassRange = new vscode.Range( + new vscode.Position(phpClass.ast.loc.start.line - 1, phpClass.ast.loc.start.column), + new vscode.Position(phpClass.ast.loc.end.line - 1, phpClass.ast.loc.end.column) + ); + + let newDocumentText = document.getText(phpClassRange); + + const astClassBody = phpClass.ast.body; + for (let i = 0; i < astClassBody.length; i++) { + const node = astClassBody[i]; + + if (node.kind === 'propertystatement') { + let newPropertyStatementText; + + for (let j = 0; j < node.properties.length; j++) { + const propertyNode = node.properties[j]; + + if (propertyNode.name?.name == property.getName()) { + const propertyStatementRange = new vscode.Range( + new vscode.Position(node.loc.start.line - 1, 0), + new vscode.Position(node.loc.end.line, 0) + ); + + const propertyStatementText = document.getText(propertyStatementRange); + + let newPropertyText = `\$${property.getName()}`; + + if (config('phpAddProperty.property.types') === true || propertyNode.type) { + newPropertyText = `${newPropertyType} ${newPropertyText}`; + } + + newPropertyStatementText = propertyStatementText.replace( + propertyNode.loc.source, + newPropertyText + ); + + newDocumentText = newDocumentText.replace(propertyStatementText, newPropertyStatementText); + } + } + + if (newPropertyStatementText) { + for (let i = 0; i < node.leadingComments?.length; i++) { + const commentNode = node.leadingComments[i]; + + const commentRange = new vscode.Range( + new vscode.Position(commentNode.loc.start.line - 1, 0), + new vscode.Position(commentNode.loc.end.line, 0) + ); + + const commentText = document.getText(commentRange); + + const typeMatch = /@var\s(\S*)/g.exec(commentText); + + if (typeMatch) { + const newCommentText = commentText.replace(typeMatch[1], newPropertyType); + + const regexp = new RegExp( + `${escapeForRegExp(commentText)}((?:\s|[\r\n])*)${escapeForRegExp(newPropertyStatementText)}` + ); + newDocumentText = newDocumentText.replace( + regexp, + `${newCommentText}$1${newPropertyStatementText}` + ); + } + } + + break; + } + } + } + + const constructor = phpClass.getConstructor(); + + if (constructor) { + for (let i = 0; i < constructor.ast.arguments.length; i++) { + const node = constructor.ast.arguments[i]; + + if (node.name?.name == property.getName()) { + const constructorText = constructor.ast.loc.source; + const newConstructorText = constructorText.replace( + node.loc.source, + `${newPropertyType} \$${property.getName()}` + ); + newDocumentText = newDocumentText.replace(constructorText, newConstructorText); + break; + } + } + + for (let i = 0; i < constructor.ast.leadingComments?.length; i++) { + const commentNode = constructor.ast.leadingComments[i]; + + const commentRange = new vscode.Range( + new vscode.Position(commentNode.loc.start.line - 1, 0), + new vscode.Position(commentNode.loc.end.line, 0) + ); + + const commentText = document.getText(commentRange); + + const regexp = new RegExp(`\\S*(\\s+\\$${property.getName()})`); + const newCommentText = commentText.replace( + regexp, + `${newPropertyType}$1` + ); + + newDocumentText = newDocumentText.replace(commentText, newCommentText); + } + } + + if (newDocumentText === document.getText(phpClassRange)) { + return; + } + + vscode.window.activeTextEditor?.edit( + editBuilder => { + editBuilder.replace(phpClassRange, newDocumentText); + }, + { + undoStopBefore: true, + undoStopAfter: false + } + ); +} diff --git a/src/class.ts b/src/class.ts new file mode 100644 index 0000000..dc3ddef --- /dev/null +++ b/src/class.ts @@ -0,0 +1,27 @@ +import Constructor from './constructor'; + +export default class Class { + public ast: any; + + private construct?: Constructor; + + constructor(ast: any) { + this.ast = ast; + + this.findConstructor(); + } + + public getConstructor() { + return this.construct; + } + + private findConstructor() { + for (let i = 0; i < this.ast.body.length; i++) { + const node = this.ast.body[i]; + + if (node.kind === 'method' && node.name?.name === '__construct') { + this.construct = new Constructor(node); + } + } + } +} diff --git a/src/constants.ts b/src/constants.ts new file mode 100644 index 0000000..81ad256 --- /dev/null +++ b/src/constants.ts @@ -0,0 +1,7 @@ +export const extensionId = 'php-add-property'; +export const extensionQualifiedId = `kotfire.${extensionId}`; +export const debugEnvName = 'PHP_ADD_PROPERTY_DEBUG_MODE'; + +export enum GlobalState { + version = 'phpAddPropertyVersion' +} \ No newline at end of file diff --git a/src/constructor.ts b/src/constructor.ts new file mode 100644 index 0000000..0ea68ee --- /dev/null +++ b/src/constructor.ts @@ -0,0 +1,7 @@ +export default class Constructor { + public ast: any; + + constructor(ast: any) { + this.ast = ast; + } +} diff --git a/src/extension.js b/src/extension.js deleted file mode 100644 index f8f0614..0000000 --- a/src/extension.js +++ /dev/null @@ -1,23 +0,0 @@ -const vscode = require('vscode'); -const AddProperty = require('./AddProperty'); - -function activate(context) { - let addProperty = new AddProperty(); - - context.subscriptions.push( - vscode.commands.registerCommand('phpAddProperty.add', () => { - if (vscode.window.activeTextEditor !== undefined) { - addProperty.add(); - } - }), - vscode.commands.registerCommand('phpAddProperty.append', () => { - if (vscode.window.activeTextEditor !== undefined) { - addProperty.append(); - } - }) - ); - - context.subscriptions.push(addProperty); -} - -exports.activate = activate; \ No newline at end of file diff --git a/src/extension.ts b/src/extension.ts new file mode 100644 index 0000000..0e769a4 --- /dev/null +++ b/src/extension.ts @@ -0,0 +1,483 @@ +import * as vscode from 'vscode'; +import PhpEngine from 'php-parser'; +import Locator from './locator'; +import Property from './property'; +import insertProperty from './insertProperty'; +import { removeProperty } from './removeProperty'; +import { forceBreakConstructorIntoMultiline, getPropertyNameFromLineText, isDebugMode, config } from './utils'; +import { renameProperty } from './renameProperty'; +import { changePropertyType } from './changePropertyType'; +import { extensionQualifiedId, GlobalState } from './constants'; + +export async function activate(context: vscode.ExtensionContext) { + const extension = vscode.extensions.getExtension(extensionQualifiedId)!; + const version = extension.packageJSON.version; + const previousVersion = context.globalState.get(GlobalState.version); + + const versionAsInt = parseInt((version as string).replace(/\./g, '')); + const previousVersionAsInt = previousVersion ? parseInt((previousVersion as string).replace(/\./g, '')) : 0; + + const showUpdatesEnabled = config('phpAddProperty.showVersionUpdates') === true; + + if (isDebugMode() || (showUpdatesEnabled && previousVersionAsInt < versionAsInt)) { + try { + const extensionRoot = context.asAbsolutePath(`webviews/${version}`); + const filename = `${extensionRoot}/index.html`; + const doc = await vscode.workspace.openTextDocument(filename); + const content = doc.getText(); + + const html = content.replace( + /#{root}/g, + vscode.Uri.file(extensionRoot) + .with({ scheme: 'vscode-resource' }) + .toString() + ); + + const panel = vscode.window.createWebviewPanel( + `phpAddPropertyWebView-${version}`, + `PHP Add Property: What's new in v${version}`, + vscode.ViewColumn.One, + { + localResourceRoots: [vscode.Uri.file(context.extensionPath)], + } + ); + + panel.iconPath = vscode.Uri.file(context.asAbsolutePath('images/icon.png')); + panel.webview.html = html; + } catch (error) { + if (isDebugMode()) { + console.error(error); + } + } + } + + context.globalState.update(GlobalState.version, version); + + context.subscriptions.push( + vscode.commands.registerCommand('phpAddProperty.add', async () => { + if (vscode.window.activeTextEditor === undefined) { + return; + } + + const document = vscode.window.activeTextEditor.document; + + const phpEngine = new PhpEngine({ + ast: { + withPositions: false, + withSource: true, + }, + lexer: { + debug: false, + all_tokens: true, + comment_tokens: true, + mode_eval: false, + asp_tags: false, + short_tags: true, + }, + parser: { + debug: false, + extractDoc: true, + suppressErrors: true + }, + }); + + const ast = phpEngine.parseCode(document.getText()); + + const locator = new Locator(ast); + + const selectionLineNumber = vscode.window.activeTextEditor.selection.active.line; + + const phpClass = locator.findClass(selectionLineNumber + 1); + + if (!phpClass) { + vscode.window.showInformationMessage('No class found'); + + return; + } + + const name = await vscode.window.showInputBox({ + placeHolder: 'Enter the property name' + }); + + if (name === undefined || name.trim() === "") { + return; + } + + const property = new Property(name); + + insertProperty(vscode.window.activeTextEditor, property, phpClass, `${property.getName()};`); + }), + vscode.commands.registerCommand('phpAddProperty.append', async () => { + if (vscode.window.activeTextEditor === undefined) { + return; + } + + const document = vscode.window.activeTextEditor.document; + + const phpEngine = new PhpEngine({ + ast: { + withPositions: false, + withSource: true, + }, + lexer: { + debug: false, + all_tokens: true, + comment_tokens: true, + mode_eval: false, + asp_tags: false, + short_tags: true, + }, + parser: { + debug: false, + extractDoc: true, + suppressErrors: true + }, + }); + + const ast = phpEngine.parseCode(document.getText()); + + const locator = new Locator(ast); + + const selectionLineNumber = vscode.window.activeTextEditor.selection.active.line; + + const phpClass = locator.findClass(selectionLineNumber + 1); + + if (!phpClass) { + vscode.window.showInformationMessage('No class found'); + + return; + } + + const line = document.lineAt(selectionLineNumber); + + const lineAst = (phpEngine.parseEval(`class A { ${line.text} }`) as any); + + if (lineAst.children[0]?.body[0]?.kind !== 'propertystatement') { + return; + } + + const selectedWord = document.getText(document.getWordRangeAtPosition(vscode.window.activeTextEditor.selection.active)).replace(/^\$/, ''); + + const properties = (lineAst.children[0].body[0].properties as any[]); + + const propertyAst = properties.find((propertyAst) => propertyAst.name?.name === selectedWord) ?? properties[0]; + + const propertyName = propertyAst.name?.name; + + const propertyStatementAst = phpClass.ast.body.find((node: any) => { + if (node.kind !== 'propertystatement') { + return false + } + + return node.properties.find((propertyAst: any) => propertyAst.name?.name === propertyName); + }); + + if (!propertyStatementAst) { + return; + } + + let docblockType; + for (let i = 0; i < propertyStatementAst.leadingComments?.length; i++) { + const node = propertyStatementAst.leadingComments[i]; + + if (node.kind !== 'commentblock') { + continue; + } + + const typeMatch = /@var\s(\S*)/g.exec(node.value); + + if (typeMatch) { + docblockType = typeMatch[1]; + + let types = docblockType.split('|').map(type => type.trim()); + const nullableTypeIndex = types.indexOf('null'); + + if (nullableTypeIndex !== -1) { + types.splice(nullableTypeIndex, 1); + + docblockType = `?${types.join('|')}`; + } + } + } + + const property = new Property(propertyName, propertyAst.nullable, propertyAst.type?.name ?? docblockType); + + insertProperty(vscode.window.activeTextEditor, property, phpClass, line.text); + }), + vscode.commands.registerCommand('phpAddProperty.rename', async () => { + if (vscode.window.activeTextEditor === undefined) { + return; + } + + const document = vscode.window.activeTextEditor.document; + + const phpEngine = new PhpEngine({ + ast: { + withPositions: false, + withSource: true, + }, + lexer: { + debug: false, + all_tokens: true, + comment_tokens: true, + mode_eval: false, + asp_tags: false, + short_tags: true, + }, + parser: { + debug: false, + extractDoc: true, + suppressErrors: true + }, + }); + + const ast = phpEngine.parseCode(document.getText()); + + const locator = new Locator(ast); + + const selectionLineNumber = vscode.window.activeTextEditor.selection.active.line; + + const phpClass = locator.findClass(selectionLineNumber); + + if (!phpClass) { + vscode.window.showInformationMessage('No class found'); + + return; + } + + const line = document.lineAt(selectionLineNumber); + + let propertyName = getPropertyNameFromLineText( + line.text, + document, + phpEngine, + vscode.window.activeTextEditor.selection.active + ); + + if (!propertyName) { + propertyName = await vscode.window.showInputBox({ + placeHolder: 'Enter the property name you want to rename' + }); + } + + if (propertyName === undefined || propertyName.trim() === "") { + return; + } + + const property = new Property(propertyName); + + const newPropertyName = await vscode.window.showInputBox({ + placeHolder: 'Enter the new property name' + }); + + if (newPropertyName === undefined || newPropertyName.trim() === "") { + return; + } + + const newProperty = new Property(newPropertyName); + + renameProperty(vscode.window.activeTextEditor, property, newProperty, phpClass); + }), + vscode.commands.registerCommand('phpAddProperty.changeType', async () => { + if (vscode.window.activeTextEditor === undefined) { + return; + } + + const document = vscode.window.activeTextEditor.document; + + const phpEngine = new PhpEngine({ + ast: { + withPositions: false, + withSource: true, + }, + lexer: { + debug: false, + all_tokens: true, + comment_tokens: true, + mode_eval: false, + asp_tags: false, + short_tags: true, + }, + parser: { + debug: false, + extractDoc: true, + suppressErrors: true + }, + }); + + const ast = phpEngine.parseCode(document.getText()); + + const locator = new Locator(ast); + + const selectionLineNumber = vscode.window.activeTextEditor.selection.active.line; + + const phpClass = locator.findClass(selectionLineNumber); + + if (!phpClass) { + vscode.window.showInformationMessage('No class found'); + + return; + } + + const line = document.lineAt(selectionLineNumber); + + let propertyName = getPropertyNameFromLineText( + line.text, + document, + phpEngine, + vscode.window.activeTextEditor.selection.active + ); + + if (!propertyName) { + propertyName = await vscode.window.showInputBox({ + placeHolder: 'Enter the property name you want to change type' + }); + } + + if (propertyName === undefined || propertyName.trim() === "") { + return; + } + + const property = new Property(propertyName); + + const newPropertyType = await vscode.window.showInputBox({ + placeHolder: 'Enter the new property type' + }); + + if (newPropertyType === undefined || newPropertyType.trim() === "") { + return; + } + + changePropertyType(vscode.window.activeTextEditor, property, newPropertyType, phpClass); + }), + vscode.commands.registerCommand('phpAddProperty.remove', async () => { + if (vscode.window.activeTextEditor === undefined) { + return; + } + + const document = vscode.window.activeTextEditor.document; + + const phpEngine = new PhpEngine({ + ast: { + withPositions: false, + withSource: true, + }, + lexer: { + debug: false, + all_tokens: true, + comment_tokens: true, + mode_eval: false, + asp_tags: false, + short_tags: true, + }, + parser: { + debug: false, + extractDoc: true, + suppressErrors: true + }, + }); + + const ast = phpEngine.parseCode(document.getText()); + + const locator = new Locator(ast); + + const selectionLineNumber = vscode.window.activeTextEditor.selection.active.line; + + const phpClass = locator.findClass(selectionLineNumber); + + if (!phpClass) { + vscode.window.showInformationMessage('No class found'); + + return; + } + + const line = document.lineAt(selectionLineNumber); + + let propertyName = getPropertyNameFromLineText( + line.text, + document, + phpEngine, + vscode.window.activeTextEditor.selection.active + ); + + if (!propertyName) { + propertyName = await vscode.window.showInputBox({ + placeHolder: 'Enter the property name you want to remove' + }); + } + + if (propertyName === undefined || propertyName.trim() === "") { + return; + } + + const property = new Property(propertyName); + + removeProperty(vscode.window.activeTextEditor, property, phpClass); + }), + vscode.commands.registerCommand('phpAddProperty.breakConstructorIntoMultiline', async () => { + if (vscode.window.activeTextEditor === undefined) { + return; + } + + const document = vscode.window.activeTextEditor.document; + + const phpEngine = new PhpEngine({ + ast: { + withPositions: false, + withSource: true, + }, + lexer: { + debug: false, + all_tokens: true, + comment_tokens: true, + mode_eval: false, + asp_tags: false, + short_tags: true, + }, + parser: { + debug: false, + extractDoc: true, + suppressErrors: true + }, + }); + + const ast = phpEngine.parseCode(document.getText()); + + const locator = new Locator(ast); + + const selectionLineNumber = vscode.window.activeTextEditor.selection.active.line; + + const phpClass = locator.findClass(selectionLineNumber + 1); + + if (!phpClass) { + vscode.window.showInformationMessage('No class found'); + + return; + } + + const phpClassRange = new vscode.Range( + new vscode.Position(phpClass.ast.loc.start.line - 1, phpClass.ast.loc.start.column), + new vscode.Position(phpClass.ast.loc.end.line - 1, phpClass.ast.loc.end.column) + ); + + const newDocumentText = forceBreakConstructorIntoMultiline(document.getText(phpClassRange)); + + if (newDocumentText === document.getText(phpClassRange)) { + return; + } + + vscode.window.activeTextEditor?.edit( + editBuilder => { + editBuilder.replace(phpClassRange, newDocumentText); + }, + { + undoStopBefore: true, + undoStopAfter: false + } + ); + }) + ); +} + +// this method is called when your extension is deactivated +export function deactivate() { } diff --git a/src/insertProperty.ts b/src/insertProperty.ts new file mode 100644 index 0000000..8ba675f --- /dev/null +++ b/src/insertProperty.ts @@ -0,0 +1,207 @@ +import * as vscode from 'vscode'; +import PhpClass from './class'; +import Property from './property'; +import addPropertyStatement from './addPropertyStatement'; +import { config, indentText, getVisibilityChoice, escapeForSnippet, calculateIndentationLevel, getLineFirstNonIndentationCharacterIndex, breakConstructorIntoMultiline, replaceWithSnippet } from './utils'; + +export default function insertProperty(editor: vscode.TextEditor, property: Property, phpClass: PhpClass, anchorText: string) { + let tabStops = { + propertyDocblockType: 1, + propertyDocblockImport: 2, + propertyVisibility: 3, + constructorDocblockType: 4, + constructorDocblockImport: 5, + constructorDocblockDescription: 6, + constructorVisibility: 7, + constructorParameterType: 8, + constructorParameterStop: 9 + }; + + const document = editor.document; + const phpClassRange = new vscode.Range( + new vscode.Position(phpClass.ast.loc.start.line - 1, phpClass.ast.loc.start.column), + new vscode.Position(phpClass.ast.loc.end.line - 1, phpClass.ast.loc.end.column) + ); + + let newDocumentText = addPropertyStatement(document, phpClass, property, tabStops); + + if (!phpClass.getConstructor()) { + let snippet = "\n\n"; + + if (config('phpAddProperty.constructor.docblock.enable') === true) { + snippet += indentText("/**\n") + + indentText(" * Constructor.\n") + + indentText(`${property.getConstructorParamDocblockText(tabStops)}\n`) + + indentText(" */\n") + } + + const visibility = (config('phpAddProperty.constructor.visibility.default') as string); + let constructorText = indentText( + config('phpAddProperty.constructor.visibility.choose') === true + ? `\${${tabStops.constructorVisibility}${getVisibilityChoice(visibility)}} ` + : `${visibility} ` + ); + + const parameterText = property.getParameterText(tabStops); + + constructorText += `function __construct(${parameterText})\n` + + indentText('{\n') + + indentText(`\\$this->${property.getName()} = \\$${property.getName()};\$0\n`, 2) + + indentText('}'); + + snippet += constructorText; + + const searchText = escapeForSnippet(anchorText); + + newDocumentText = newDocumentText.replace(searchText, `${searchText}${snippet}`); + } else { + const constructor = phpClass.getConstructor()?.ast; + + let docblock; + for (let i = 0; i < constructor.leadingComments?.length; i++) { + const node = constructor.leadingComments[i]; + + if (node.kind === 'commentblock') { + docblock = node; + break; + } + } + + if (docblock) { + const paramRegex = /@param(?:\s+\S+)?\s+\$(\S+).*/g; + + let paramExists = false; + let lastParamText; + let paramMatch; + while (paramMatch = paramRegex.exec(docblock.value)) { + lastParamText = paramMatch[0]; + if (paramMatch[1] === property.getName()) { + paramExists = true; + break; + } + } + + if (!paramExists) { + if (lastParamText) { + const docblockClosingLine = editor.document.lineAt(docblock.loc.start.line - 1); + + newDocumentText = newDocumentText.replace( + escapeForSnippet(lastParamText), + escapeForSnippet(lastParamText) + "\n" + indentText( + property.getConstructorParamDocblockText(tabStops), + calculateIndentationLevel( + getLineFirstNonIndentationCharacterIndex(docblockClosingLine.text) + ) + ) + ); + } + } + } + + let argumentExists = false; + for (let i = 0; i < constructor.arguments.length; i++) { + const node = constructor.arguments[i]; + + if (node.name?.name == property.getName()) { + argumentExists = true; + break; + } + } + + if (!argumentExists) { + const constructorMethodText = (constructor.loc.source as string); + const constructorHasArgs = constructor.arguments.length > 0; + + let newConstructorMethodText = ''; + + const isMultiLineConstructor = (/\(\r\n|\r|\n/.test(constructorMethodText)); //constructor.loc.start.line !== constructor.loc.end.line; + + const argumentText = property.getParameterText(tabStops); + if (constructorHasArgs) { + const lastArg = constructor.arguments[constructor.arguments.length - 1]; + + const lastArgLine = document.lineAt(lastArg.loc.end.line - 1); + + let newArg = escapeForSnippet(`${lastArg.loc.source}`); + + if (isMultiLineConstructor) { + newArg += ",\n" + indentText( + argumentText, + calculateIndentationLevel( + getLineFirstNonIndentationCharacterIndex(lastArgLine.text) + ) + ); + } else { + newArg += `, ${argumentText}`; + } + + newConstructorMethodText = escapeForSnippet(constructorMethodText).replace(escapeForSnippet(lastArg.loc.source), newArg); + } else { + const argsParenthesis = /\(\)/; + + newConstructorMethodText = constructorMethodText.replace(argsParenthesis, `(${argumentText})`); + } + + newDocumentText = newDocumentText.replace(escapeForSnippet(constructorMethodText), newConstructorMethodText); + } + + let assignationExists = false; + for (let i = 0; i < constructor.body?.children.length; i++) { + const node = constructor.body.children[i]; + + if (node.kind === 'expressionstatement' + && node.expression.kind === 'assign' + && node.expression.left.kind === 'propertylookup' + && node.expression.left.offset.name === property.getName() + ) { + assignationExists = true; + break; + } + } + + if (!assignationExists) { + const constructorBodyText = constructor.body.loc.source; + const constructorBodyLine = document.lineAt(constructor.body.loc.start.line - 1); + + const constructorBodyIsEmpty = constructor.body.children.length === 0; + + let newConstructorBodyText = ''; + if (constructorBodyIsEmpty) { + const indentationLevel = calculateIndentationLevel( + getLineFirstNonIndentationCharacterIndex(constructorBodyLine.text) + ); + + newConstructorBodyText = "{\n" + indentText( + `\\$this->${property.getName()} = \\$${property.getName()};\$0\n`, + indentationLevel + 1 + ) + indentText("}", indentationLevel); + } else { + const lastChildren = constructor.body.children[constructor.body.children.length - 1]; + const lastChildrenText = lastChildren.loc.source; + const lastChildrenLine = document.lineAt(lastChildren.loc.end.line - 1); + + const indentationLevel = calculateIndentationLevel( + getLineFirstNonIndentationCharacterIndex(lastChildrenLine.text) + ); + + newConstructorBodyText = escapeForSnippet(constructorBodyText).replace( + escapeForSnippet(lastChildrenText), + escapeForSnippet(lastChildrenText) + "\n" + indentText( + `\\$this->${property.getName()} = \\$${property.getName()};\$0`, + indentationLevel + ) + ); + } + + newDocumentText = newDocumentText.replace(escapeForSnippet(constructorBodyText), newConstructorBodyText); + } + } + + newDocumentText = breakConstructorIntoMultiline(newDocumentText); + + if (newDocumentText === escapeForSnippet(document.getText(phpClassRange))) { + return; + } + + replaceWithSnippet(newDocumentText, phpClassRange); +} \ No newline at end of file diff --git a/src/locator.ts b/src/locator.ts new file mode 100644 index 0000000..aaeb45b --- /dev/null +++ b/src/locator.ts @@ -0,0 +1,62 @@ +import Class from "./class"; +import Constructor from "./constructor"; + +export default class Locator { + private ast: any; + + constructor(ast: any) { + this.ast = ast; + } + + findClass(cursorAtLine?: number): Class | undefined { + let firstClass: Class | undefined; + const cursorClass = filter(this.ast, 'class', function (node: any) { + if (!firstClass) { + firstClass = new Class(node); + } + if (!cursorAtLine || (cursorAtLine >= node.loc.start.line && cursorAtLine <= node.loc.end.line)) { + return new Class(node); + } + }); + + return cursorClass || firstClass; + } + + findConstructor(): Constructor | undefined { + return filter(this.ast, 'method', function (node: any) { + if (node.name?.name === '__construct') { + return new Constructor(node); + } + }); + } +} + +function filter(ast: any, kind: string, matcher: Function): any { + let result; + + if (Array.isArray(ast)) { + for (var i = 0; i < ast.length; i++) { + result = filter(ast[i], kind, matcher); + if (result) { + return result; + } + } + } else { + if (ast?.kind === kind) { + result = matcher(ast); + + if (result) { + return result; + } + } + + for (const node in ast) { + if (ast.hasOwnProperty(node) && ast[node] !== ast) { + result = filter(ast[node], kind, matcher); + if (result) { + return result; + } + } + } + } +} diff --git a/src/property.ts b/src/property.ts new file mode 100644 index 0000000..dfa7f9f --- /dev/null +++ b/src/property.ts @@ -0,0 +1,132 @@ +import { config, indentText, getVisibilityChoice } from "./utils"; + +export default class Property { + private name: string; + private nullable: Boolean; + private type?: string; + + constructor(name: string, nullable: Boolean = false, type?: string) { + this.name = name; + this.nullable = nullable; + this.type = type; + } + + public getName() { + return this.name; + } + + public isNullable() { + return this.nullable === true; + } + + public getType() { + return this.type; + } + + public getStatementText(tabStops: any): string { + let docblockTypeStop = tabStops.propertyDocblockType; + let dockblockImportStop = tabStops.propertyDocblockImport; + + if (config('phpAddProperty.property.docblock.withParameter') === true) { + docblockTypeStop = tabStops.constructorParameterType; + dockblockImportStop = tabStops.constructorParameterStop; + tabStops.constructorParameterStop++; + } + + let propertyStatementText = ''; + if (config('phpAddProperty.property.docblock.add') === true) { + let stopText = ''; + + if (config('phpAddProperty.property.docblock.stopToImport') === true) { + stopText += `$${dockblockImportStop}`; + } + + stopText += `$${docblockTypeStop}`; + + if (config('phpAddProperty.property.docblock.multiline') === true) { + propertyStatementText += `/**\n${indentText(' * @var ')}${stopText}\n${indentText(' */')}\n${indentText('')}`; + } else { + if (config('phpAddProperty.property.docblock.withParameter') === false) { + stopText += ' '; + } + + propertyStatementText += `/** @var ${stopText}*/\n${indentText('')}`; + } + } + + const visibility = (config('phpAddProperty.property.visibility.default') as string); + propertyStatementText += config('phpAddProperty.property.visibility.choose') === true + ? `\${${tabStops.propertyVisibility}${getVisibilityChoice(visibility)}} ` + : `${visibility} `; + + if (config('phpAddProperty.property.types') === true) { + propertyStatementText += `$${tabStops.constructorParameterType}`; + } + propertyStatementText += `\\$${this.getName()};`; + + return propertyStatementText; + } + + public getParameterText(tabStops: any): string { + let tabStopsText = `$${tabStops.constructorParameterType}`; + + if (this.getType()) { + let typeText = this.getType(); + + if (this.isNullable()) { + typeText = `?${typeText}`; + } + + tabStopsText = `\${${tabStops.constructorParameterType}:${typeText}}`; + } + + if (config('phpAddProperty.property.stopToImport') === true) { + tabStopsText += `$${tabStops.constructorParameterStop}`; + } + + let parameterText = `${tabStopsText}`; + + if (this.getType()) { + parameterText += ' '; + } + + parameterText += `\\$${this.getName()}`; + + return parameterText; + } + + public getConstructorParamDocblockText(tabStops: any): string { + let docblockTypeStop = tabStops.constructorDocblockType; + let dockblockImportStop = tabStops.constructorDocblockImport; + + if (config('phpAddProperty.constructor.docblock.withParameter') === true) { + docblockTypeStop = tabStops.constructorParameterType; + dockblockImportStop = tabStops.constructorParameterStop; + tabStops.constructorParameterStop++; + } + + let constructorParamDocblockText = `\${${docblockTypeStop}}`; + + if (this.getType()) { + let typeText = this.getType(); + + if (this.isNullable()) { + typeText = `${typeText}|null`; + } + + constructorParamDocblockText = `\${${docblockTypeStop}:${typeText}} `; + } + + if (config('phpAddProperty.constructor.docblock.stopToImport') === true) { + constructorParamDocblockText += `\$${dockblockImportStop}`; + } + + constructorParamDocblockText += `\\$${this.getName()}`; + + if (config('phpAddProperty.constructor.docblock.stopForDescription') === true) { + constructorParamDocblockText += `\$${tabStops.constructorDocblockDescription}`; + } + + return ` * @param ${constructorParamDocblockText}`; + } +} diff --git a/src/removeProperty.ts b/src/removeProperty.ts new file mode 100644 index 0000000..4751aa4 --- /dev/null +++ b/src/removeProperty.ts @@ -0,0 +1,162 @@ +import * as vscode from 'vscode'; +import Property from './property'; +import Class from './class'; +import { escapeForRegExp } from './utils'; + +export function removeProperty(editor: vscode.TextEditor, property: Property, phpClass: Class) { + const document = editor.document; + const phpClassRange = new vscode.Range( + new vscode.Position(phpClass.ast.loc.start.line - 1, phpClass.ast.loc.start.column), + new vscode.Position(phpClass.ast.loc.end.line - 1, phpClass.ast.loc.end.column) + ); + + let newDocumentText = document.getText(phpClassRange); + + const astClassBody = phpClass.ast.body; + for (let i = 0; i < astClassBody.length; i++) { + const node = astClassBody[i]; + + if (node.kind === 'propertystatement') { + for (let j = 0; j < node.properties.length; j++) { + const propertyNode = node.properties[j]; + + if (propertyNode.name?.name === property.getName()) { + if (node.properties.length === 1) { + let nextNotEmptyLine = node.loc.end.line; + + if (i + 1 < astClassBody.length) { + const nextNode = astClassBody[i + 1]; + + const startLine = nextNode.leadingComments + ? nextNode.leadingComments[0].loc.start.line + : nextNode.loc.start.line; + + nextNotEmptyLine = startLine - 1; + } + + const propertyStatementRange = new vscode.Range( + new vscode.Position(node.loc.start.line - 1, 0), + new vscode.Position(nextNotEmptyLine, 0) + ); + + const propertyStatementText = document.getText(propertyStatementRange); + + newDocumentText = newDocumentText.replace(propertyStatementText, ''); + } else { + const regexp = new RegExp(`(,\\s*(?!.*,))?${escapeForRegExp(propertyNode.loc.source)}(\\s*,\\s*)?`); + newDocumentText = newDocumentText.replace(regexp, ''); + } + + for (let i = 0; i < node.leadingComments?.length; i++) { + const commentNode = node.leadingComments[i]; + + const commentRange = new vscode.Range( + new vscode.Position(commentNode.loc.start.line - 1, 0), + new vscode.Position(commentNode.loc.end.line, 0) + ); + + const commentText = document.getText(commentRange); + + newDocumentText = newDocumentText.replace(commentText, ''); + } + + break; + } + } + } + } + + const constructor = phpClass.getConstructor(); + + if (constructor) { + if (constructor.ast.body?.children.length <= 1) { + const node = constructor.ast.arguments[0]; + + if (constructor.ast.body.children.length == 0 || node.name?.name == property.getName()) { + const constructorRange = new vscode.Range( + new vscode.Position(constructor.ast.loc.start.line - 1, 0), + new vscode.Position(constructor.ast.loc.end.line, 0) + ); + + const constructorText = document.getText(constructorRange); + + newDocumentText = newDocumentText.replace(constructorText, ''); + + for (let i = 0; i < constructor.ast.leadingComments?.length; i++) { + const commentNode = constructor.ast.leadingComments[i]; + + const commentRange = new vscode.Range( + new vscode.Position(commentNode.loc.start.line - 1, 0), + new vscode.Position(commentNode.loc.end.line, 0) + ); + + const commentText = document.getText(commentRange); + + newDocumentText = newDocumentText.replace(commentText, ''); + } + } + } else { + for (let i = 0; i < constructor.ast.arguments.length; i++) { + const node = constructor.ast.arguments[i]; + + if (node.name?.name == property.getName()) { + const constructorText = constructor.ast.loc.source; + const regexp = new RegExp(`(,\\s*(?!.*,))?${escapeForRegExp(node.loc.source)}(\\s*,\\s*)?`); + const newConstructorText = constructorText.replace(regexp, ''); + newDocumentText = newDocumentText.replace(constructorText, newConstructorText); + break; + } + } + + for (let i = 0; i < constructor.ast.body?.children.length; i++) { + const node = constructor.ast.body.children[i]; + + if (node.kind === 'expressionstatement' + && node.expression.kind === 'assign' + && node.expression.left.kind === 'propertylookup' + && node.expression.left.offset.name === property.getName() + ) { + const propertyAssignmentRange = new vscode.Range( + new vscode.Position(node.loc.start.line - 1, 0), + new vscode.Position(node.loc.end.line, 0) + ); + + const propertyAssignmentText = document.getText(propertyAssignmentRange); + + newDocumentText = newDocumentText.replace(propertyAssignmentText, ''); + break; + } + } + + for (let i = 0; i < constructor.ast.leadingComments?.length; i++) { + const commentNode = constructor.ast.leadingComments[i]; + + const commentRange = new vscode.Range( + new vscode.Position(commentNode.loc.start.line - 1, 0), + new vscode.Position(commentNode.loc.end.line, 0) + ); + + const commentText = document.getText(commentRange); + + const regexp = new RegExp(`.*\\*.*\\$${property.getName()}\\s*[\r\n]+`); + const newCommentText = commentText.replace(regexp, ''); + + newDocumentText = newDocumentText.replace(commentText, newCommentText); + } + } + } + + if (newDocumentText === document.getText(phpClassRange)) { + return; + } + + vscode.window.activeTextEditor?.edit( + editBuilder => { + editBuilder.replace(phpClassRange, newDocumentText); + }, + { + undoStopBefore: true, + undoStopAfter: false + } + ); +} diff --git a/src/renameProperty.ts b/src/renameProperty.ts new file mode 100644 index 0000000..df07ff3 --- /dev/null +++ b/src/renameProperty.ts @@ -0,0 +1,194 @@ +import * as vscode from 'vscode'; +import Property from './property'; +import Class from './class'; + +export function renameProperty(editor: vscode.TextEditor, property: Property, newProperty: Property, phpClass: Class) { + const document = editor.document; + const phpClassRange = new vscode.Range( + new vscode.Position(phpClass.ast.loc.start.line - 1, phpClass.ast.loc.start.column), + new vscode.Position(phpClass.ast.loc.end.line - 1, phpClass.ast.loc.end.column) + ); + + let newDocumentText = document.getText(phpClassRange); + + const astClassBody = phpClass.ast.body; + for (let i = 0; i < astClassBody.length; i++) { + const node = astClassBody[i]; + + if (node.kind === 'propertystatement') { + for (let j = 0; j < node.properties.length; j++) { + const propertyNode = node.properties[j]; + + if (propertyNode.name?.name === property.getName()) { + if (node.properties.length === 1) { + const propertyStatementRange = new vscode.Range( + new vscode.Position(node.loc.start.line - 1, 0), + new vscode.Position(node.loc.end.line, 0) + ); + + const propertyStatementText = document.getText(propertyStatementRange); + + const newPropertyStatementText = propertyStatementText.replace( + property.getName(), + newProperty.getName() + ); + + newDocumentText = newDocumentText.replace(propertyStatementText, newPropertyStatementText); + } else { + const regexp = new RegExp(`\\$${property.getName()}(\\s*,|\\s*;)`); + newDocumentText = newDocumentText.replace( + regexp, + `\$${newProperty.getName()}$1` + ); + } + + break; + } + } + } + } + + const constructor = phpClass.getConstructor(); + + if (constructor) { + if (constructor.ast.arguments.length == 1) { + const node = constructor.ast.arguments[0]; + + if (node.name?.name == property.getName()) { + const constructorText = constructor.ast.loc.source; + const newConstructorText = constructorText.replace( + `\$${property.getName()}`, + `\$${newProperty.getName()}` + ); + + newDocumentText = newDocumentText.replace(constructorText, newConstructorText); + } + } else { + for (let i = 0; i < constructor.ast.arguments.length; i++) { + const node = constructor.ast.arguments[i]; + + if (node.name?.name == property.getName()) { + const constructorText = constructor.ast.loc.source; + const newConstructorText = constructorText.replace( + `\$${property.getName()},`, + `\$${newProperty.getName()},` + ); + newDocumentText = newDocumentText.replace(constructorText, newConstructorText); + break; + } + } + } + + for (let i = 0; i < constructor.ast.body?.children.length; i++) { + const node = constructor.ast.body.children[i]; + + if (node.kind === 'expressionstatement' + && node.expression.kind === 'assign' + && node.expression.left.kind === 'propertylookup' + && node.expression.left.offset.name === property.getName() + ) { + const propertyAssignmentRange = new vscode.Range( + new vscode.Position(node.loc.start.line - 1, 0), + new vscode.Position(node.loc.end.line, 0) + ); + + const propertyAssignmentText = document.getText(propertyAssignmentRange); + let newPropertyAssignmentText = propertyAssignmentText.replace( + property.getName(), + newProperty.getName() + ); + + if (node.expression.right.kind === 'variable' && node.expression.right.name === property.getName()) { + newPropertyAssignmentText = newPropertyAssignmentText.replace( + `\$${property.getName()}`, + `\$${newProperty.getName()}` + ); + } + + newDocumentText = newDocumentText.replace(propertyAssignmentText, newPropertyAssignmentText); + break; + } + } + + for (let i = 0; i < constructor.ast.leadingComments?.length; i++) { + const commentNode = constructor.ast.leadingComments[i]; + + const commentRange = new vscode.Range( + new vscode.Position(commentNode.loc.start.line - 1, 0), + new vscode.Position(commentNode.loc.end.line, 0) + ); + + const commentText = document.getText(commentRange); + + const regexp = new RegExp(`\\$${property.getName()}(\\s+)`); + const newCommentText = commentText.replace( + regexp, + `\$${newProperty.getName()}$1` + ); + + newDocumentText = newDocumentText.replace(commentText, newCommentText); + } + } + + const propertyReferences = findPropertyReferences(phpClass.ast, property.getName()); + + for (let i = 0; i < propertyReferences.length; i++) { + const node = propertyReferences[i]; + + const propertyReferenceRange = new vscode.Range( + new vscode.Position(node.loc.start.line - 1, 0), + new vscode.Position(node.loc.end.line, 0) + ); + + const propertyReferenceText = document.getText(propertyReferenceRange); + + const newPropertyReferenceText = propertyReferenceText.replace( + `this->${property.getName()}`, + `this->${newProperty.getName()}` + ); + + newDocumentText = newDocumentText.replace(propertyReferenceText, newPropertyReferenceText); + } + + if (newDocumentText === document.getText(phpClassRange)) { + return; + } + + vscode.window.activeTextEditor?.edit( + editBuilder => { + editBuilder.replace(phpClassRange, newDocumentText); + }, + { + undoStopBefore: true, + undoStopAfter: false + } + ); +} + +function findPropertyReferences(ast: any, name: string): any { + let propertyReferences: any = []; + + if (Array.isArray(ast)) { + for (var i = 0; i < ast.length; i++) { + const newPropertyReferences = findPropertyReferences(ast[i], name); + for (let i = 0; i < newPropertyReferences.length; i++) { + propertyReferences.push(newPropertyReferences[i]); + } + } + } else { + if (ast?.kind === 'propertylookup' && ast.offset?.name === name) { + return [ast]; + } + + for (const node in ast) { + if (ast.hasOwnProperty(node) && ast[node] !== ast) { + const newPropertyReferences = findPropertyReferences(ast[node], name); + for (let i = 0; i < newPropertyReferences.length; i++) { + propertyReferences.push(newPropertyReferences[i]); + } + } + } + } + + return propertyReferences; +} diff --git a/src/test/runTest.ts b/src/test/runTest.ts new file mode 100644 index 0000000..0752773 --- /dev/null +++ b/src/test/runTest.ts @@ -0,0 +1,51 @@ +import * as path from 'path'; + +import { runTests } from 'vscode-test'; + +async function main() { + try { + // The folder containing the Extension Manifest package.json + // Passed to `--extensionDevelopmentPath` + const extensionDevelopmentPath = path.resolve(__dirname, '../../'); + + // The path to test runner + // Passed to --extensionTestsPath + const extensionTestsPath = path.resolve(__dirname, './suite/index'); + + const testUserDir = path.resolve(__dirname, './user'); + + const vscodeCompatibilityString = require('../../package.json').engines.vscode; + const vscodeMinimumVersion = vscodeCompatibilityString.replace(/[^\d\.]/g, ''); + + await runTests( + { + version: vscodeMinimumVersion, + extensionDevelopmentPath, + extensionTestsPath, + launchArgs: [ + `--user-data-dir=${testUserDir}`, + '--disable-extensions' + ], + extensionTestsEnv: { + 'VSCODE_VERSION': vscodeMinimumVersion, + } + } + ); + + await runTests( + { + extensionDevelopmentPath, + extensionTestsPath, + launchArgs: [ + `--user-data-dir=${testUserDir}`, + '--disable-extensions' + ] + } + ); + } catch (err) { + console.error('Failed to run tests'); + process.exit(1); + } +} + +main(); diff --git a/test/suite/addExistingProperty.test.js b/src/test/suite/addExistingProperty.test.ts similarity index 54% rename from test/suite/addExistingProperty.test.js rename to src/test/suite/addExistingProperty.test.ts index 04f589d..0b8b900 100644 --- a/test/suite/addExistingProperty.test.js +++ b/src/test/suite/addExistingProperty.test.ts @@ -1,8 +1,8 @@ -const vscode = require('vscode'); -const path = require('path'); -const assert = require('assert'); -const fs = require('fs'); -const {waitToAssertInSeconds, delay, resetDefaultSettings} = require('./utils'); +import * as vscode from 'vscode'; +import * as path from 'path'; +import * as assert from 'assert'; +import * as fs from 'fs'; +import { waitToAssertInSeconds, delay, resetDefaultSettings } from './utils'; const testFolderRelativeLocation = '/../fixtures/existing/'; @@ -31,19 +31,42 @@ suite('Add Existing Property', function () { await runFixture('UseDocblock.php', new vscode.Position(8, 0)); }); + test('Should add an existing property using its PHP7.4+ type', async () => { + await runFixture('UseType.php', new vscode.Position(8, 0)); + }); + test('Should add a docblock with @param using type from property docblock', async () => { await vscode.workspace.getConfiguration('phpAddProperty').update('constructor.docblock.enable', true, true); await runFixture('ConstructorDocblockUsingDocblock.php', new vscode.Position(8, 0)); }); + + test('Should NOT add an extra space when adding property type and docblock type at the same type', async () => { + await vscode.workspace.getConfiguration('phpAddProperty').update('constructor.docblock.enable', true, true); + await vscode.workspace.getConfiguration('phpAddProperty').update('constructor.docblock.withParameter', true, true); + await runFixture('DocblockTypeWithParameter.php', new vscode.Position(10, 22)); + }); + + test('Should add an existing property with a nullable type', async() => { + await vscode.workspace.getConfiguration('phpAddProperty').update('constructor.docblock.enable', true, true); + await runFixture('NullableType.php', new vscode.Position(10, 0)); + }); + + test('Should add a nullable property using type from property docblock', async() => { + await runFixture('UseNullableDocblock.php', new vscode.Position(8, 0)); + }); }); -async function runFixture(fileName, cursorPosition) { +async function runFixture(fileName: string, cursorPosition: vscode.Position) { const uri = vscode.Uri.file( getInputFilePath(fileName) ); const document = await vscode.workspace.openTextDocument(uri); await vscode.window.showTextDocument(document); + if (!vscode.window.activeTextEditor) { + return; + } + vscode.window.activeTextEditor.selections = [new vscode.Selection(cursorPosition, cursorPosition)]; await vscode.commands.executeCommand('phpAddProperty.append'); @@ -51,14 +74,14 @@ async function runFixture(fileName, cursorPosition) { const expectedText = fs.readFileSync(getOutputFilePath(fileName)).toString(); await delay(waitToAssertInSeconds, () => { - assert.strictEqual(vscode.window.activeTextEditor.document.getText(), expectedText); + assert.strictEqual(vscode.window.activeTextEditor?.document.getText(), expectedText); }); } -function getInputFilePath(name) { +function getInputFilePath(name: string) { return path.join(__dirname + testFolderRelativeLocation + `inputs/${name}`); } -function getOutputFilePath(name) { +function getOutputFilePath(name: string) { return path.join(__dirname + testFolderRelativeLocation + `outputs/${name}`); } diff --git a/test/suite/addProperty.test.js b/src/test/suite/addProperty.test.ts similarity index 63% rename from test/suite/addProperty.test.js rename to src/test/suite/addProperty.test.ts index 8e5611b..8523b29 100644 --- a/test/suite/addProperty.test.js +++ b/src/test/suite/addProperty.test.ts @@ -1,8 +1,8 @@ -const vscode = require('vscode'); -const path = require('path'); -const assert = require('assert'); -const fs = require('fs'); -const {waitToAssertInSeconds, delay, resetDefaultSettings} = require('./utils'); +import * as vscode from 'vscode'; +import * as path from 'path'; +import * as assert from 'assert'; +import * as fs from 'fs'; +import { waitToAssertInSeconds, delay, resetDefaultSettings } from './utils'; const testFolderRelativeLocation = '/../fixtures/new/'; @@ -51,6 +51,18 @@ suite('Add Property', function () { await runFixture('ClassKeyword.php'); }); + test('Should insert property in the first class if the file contains multiple', async () => { + await runFixture('MultipleClasses.php'); + }); + + test('Should insert property in the first class if the cursor is placed there', async () => { + await runFixture('MultipleClassesCursorInFirst.php', new vscode.Position(8, 0)); + }); + + test('Should insert property in the last class if the cursor is placed there', async () => { + await runFixture('MultipleClassesCursorInLast.php', new vscode.Position(13, 0)); + }); + test('Should add a docblock with @param along with the constructor', async () => { await vscode.workspace.getConfiguration('phpAddProperty').update('constructor.docblock.enable', true, true); await runFixture('AddConstructorDocblock.php'); @@ -62,30 +74,41 @@ suite('Add Property', function () { }); }); -async function runFixture(fileName) { - vscode.window.showInputBox = function () { - return 'name'; - }; - +async function runFixture(fileName: string, cursorPosition?: vscode.Position) { const uri = vscode.Uri.file( getInputFilePath(fileName) ); const document = await vscode.workspace.openTextDocument(uri); await vscode.window.showTextDocument(document); + if (!vscode.window.activeTextEditor) { + return; + } + + if (cursorPosition === undefined) { + vscode.window.showInputBox = function ( + options?: vscode.InputBoxOptions | undefined, + token?: vscode.CancellationToken | undefined + ): Thenable { + return Promise.resolve('name'); + }; + } else { + vscode.window.activeTextEditor.selections = [new vscode.Selection(cursorPosition, cursorPosition)]; + } + await vscode.commands.executeCommand('phpAddProperty.add'); const expectedText = fs.readFileSync(getOutputFilePath(fileName)).toString(); await delay(waitToAssertInSeconds, () => { - assert.strictEqual(vscode.window.activeTextEditor.document.getText(), expectedText); + assert.strictEqual(vscode.window.activeTextEditor?.document.getText(), expectedText); }); } -function getInputFilePath(name) { +function getInputFilePath(name: string) { return path.join(__dirname + testFolderRelativeLocation + `inputs/${name}`); } -function getOutputFilePath(name) { +function getOutputFilePath(name: string) { return path.join(__dirname + testFolderRelativeLocation + `outputs/${name}`); } diff --git a/src/test/suite/breakConstructorIntoMultiline.test.ts b/src/test/suite/breakConstructorIntoMultiline.test.ts new file mode 100644 index 0000000..6c4fc94 --- /dev/null +++ b/src/test/suite/breakConstructorIntoMultiline.test.ts @@ -0,0 +1,48 @@ +import * as vscode from 'vscode'; +import * as path from 'path'; +import * as assert from 'assert'; +import * as fs from 'fs'; +import { waitToAssertInSeconds, delay, resetDefaultSettings } from './utils'; + +const testFolderRelativeLocation = '/../fixtures/breakConstructorIntoMultiline/'; + +suite('Break Constructor Into Multilines', function () { + setup(async () => { + await resetDefaultSettings(); + }); + + teardown(async () => { + await resetDefaultSettings(); + }); + + test('Should break the constructor into multiline regardless of the settings', async () => { + await vscode.workspace.getConfiguration('phpAddProperty').update('constructor.breakIntoMultilineIfLengthExceeded.enabled', false, true); + await vscode.workspace.getConfiguration('phpAddProperty').update('constructor.breakIntoMultilineIfLengthExceeded.maxLineLength', 999, true); + await runFixture('Constructor.php'); + }); +}); + +async function runFixture(fileName: string) { + const uri = vscode.Uri.file( + getInputFilePath(fileName) + ); + const document = await vscode.workspace.openTextDocument(uri); + await vscode.window.showTextDocument(document); + + await vscode.commands.executeCommand('phpAddProperty.breakConstructorIntoMultiline'); + + const expectedText = fs.readFileSync(getOutputFilePath(fileName)).toString(); + + await delay(waitToAssertInSeconds, () => { + assert.strictEqual(vscode.window.activeTextEditor?.document.getText(), expectedText); + }); +} + +function getInputFilePath(name: string) { + return path.join(__dirname + testFolderRelativeLocation + `inputs/${name}`); +} + +function getOutputFilePath(name: string) { + return path.join(__dirname + testFolderRelativeLocation + `outputs/${name}`); +} + diff --git a/src/test/suite/changePropertyType.test.ts b/src/test/suite/changePropertyType.test.ts new file mode 100644 index 0000000..c2119dd --- /dev/null +++ b/src/test/suite/changePropertyType.test.ts @@ -0,0 +1,99 @@ +import * as vscode from 'vscode'; +import * as path from 'path'; +import * as assert from 'assert'; +import * as fs from 'fs'; +import { waitToAssertInSeconds, delay, resetDefaultSettings } from './utils'; + +const testFolderRelativeLocation = '/../fixtures/changePropertyType/'; + +suite('Change Property Type', function () { + setup(async () => { + await resetDefaultSettings(); + }); + + teardown(async () => { + await resetDefaultSettings(); + }); + + test('Should change a property type by name', async () => { + await runFixture('ConstructorWithMultipleProperties.php'); + }); + + test('Should change the property statement type if already exists', async () => { + await runFixture('TypedPropertyStatement.php'); + }); + + test('Should change the property statement type if typed properties is enabled', async () => { + await vscode.workspace.getConfiguration('phpAddProperty').update('property.types', true, true); + await runFixture('PropertyWithoutType.php'); + }); + + test('Should change property statement docblock type', async () => { + await runFixture('PropertyStatementDocblock.php'); + }); + + test('Should NOT change other properties statement docblock type', async () => { + await runFixture('OtherPropertiesStatementDocblock.php'); + }); + + test('Should change property type in constructor docblock', async () => { + await runFixture('ConstructorDocblock.php'); + }); + + test('Should rename a property when the cursor is placed in its constructor docblock param', async () => { + await runFixture('ConstructorWithMultiplePropertiesCursorInConstructorDocblock.php', new vscode.Position(15, 17)); + }); +}); + +async function runFixture(fileName: string, cursorPosition?: vscode.Position) { + const uri = vscode.Uri.file( + getInputFilePath(fileName) + ); + const document = await vscode.workspace.openTextDocument(uri); + await vscode.window.showTextDocument(document); + + if (!vscode.window.activeTextEditor) { + return; + } + + if (cursorPosition === undefined) { + let first = true; + vscode.window.showInputBox = function ( + options?: vscode.InputBoxOptions | undefined, + token?: vscode.CancellationToken | undefined + ): Thenable { + if (first === true) { + first = false; + + return Promise.resolve('name'); + } + + return Promise.resolve('Name'); + }; + } else { + vscode.window.activeTextEditor.selections = [new vscode.Selection(cursorPosition, cursorPosition)]; + + vscode.window.showInputBox = function ( + options?: vscode.InputBoxOptions | undefined, + token?: vscode.CancellationToken | undefined + ): Thenable { + return Promise.resolve('Name'); + }; + } + + await vscode.commands.executeCommand('phpAddProperty.changeType'); + + const expectedText = fs.readFileSync(getOutputFilePath(fileName)).toString(); + + await delay(waitToAssertInSeconds, () => { + assert.strictEqual(vscode.window.activeTextEditor?.document.getText(), expectedText); + }); +} + +function getInputFilePath(name: string) { + return path.join(__dirname + testFolderRelativeLocation + `inputs/${name}`); +} + +function getOutputFilePath(name: string) { + return path.join(__dirname + testFolderRelativeLocation + `outputs/${name}`); +} diff --git a/test/suite/customization.test.js b/src/test/suite/customizations.test.ts similarity index 80% rename from test/suite/customization.test.js rename to src/test/suite/customizations.test.ts index 76975af..f7445cf 100644 --- a/test/suite/customization.test.js +++ b/src/test/suite/customizations.test.ts @@ -1,8 +1,8 @@ -const vscode = require('vscode'); -const path = require('path'); -const assert = require('assert'); -const fs = require('fs'); -const {waitToAssertInSeconds, delay, resetDefaultSettings} = require('./utils'); +import * as vscode from 'vscode'; +import * as path from 'path'; +import * as assert from 'assert'; +import * as fs from 'fs'; +import { waitToAssertInSeconds, delay, resetDefaultSettings } from './utils'; const testFolderRelativeLocation = '/../fixtures/customizations/'; @@ -48,9 +48,12 @@ suite('Customizations', function () { }); }); -async function runFixture(fileName) { - vscode.window.showInputBox = function () { - return 'name'; +async function runFixture(fileName: string) { + vscode.window.showInputBox = function ( + options?: vscode.InputBoxOptions | undefined, + token?: vscode.CancellationToken | undefined + ): Thenable { + return Promise.resolve('name'); }; const uri = vscode.Uri.file( @@ -64,14 +67,15 @@ async function runFixture(fileName) { const expectedText = fs.readFileSync(getOutputFilePath(fileName)).toString(); await delay(waitToAssertInSeconds, () => { - assert.strictEqual(vscode.window.activeTextEditor.document.getText(), expectedText); + assert.strictEqual(vscode.window.activeTextEditor?.document.getText(), expectedText); }); } -function getInputFilePath(name) { +function getInputFilePath(name: string) { return path.join(__dirname + testFolderRelativeLocation + `inputs/${name}`); } -function getOutputFilePath(name) { +function getOutputFilePath(name: string) { return path.join(__dirname + testFolderRelativeLocation + `outputs/${name}`); } + diff --git a/test/suite/index.js b/src/test/suite/index.ts similarity index 66% rename from test/suite/index.js rename to src/test/suite/index.ts index edb89be..6ce2a57 100644 --- a/test/suite/index.js +++ b/src/test/suite/index.ts @@ -1,15 +1,13 @@ -const path = require('path'); -const Mocha = require('mocha'); -const glob = require('glob'); +import * as path from 'path'; +import * as Mocha from 'mocha'; +import * as glob from 'glob'; -function run() { +export function run(): Promise { // Create the mocha test const mocha = new Mocha({ - ui: 'tdd' + ui: 'tdd', + color: true }); - // Use any mocha API - mocha.useColors(true); - mocha.timeout(5000); const testsRoot = path.resolve(__dirname, '..'); @@ -25,6 +23,10 @@ function run() { try { // Run the mocha test mocha.run(failures => { + if (process.env.VSCODE_VERSION === '1.31.0') { + process.exit(failures > 0 ? 1 : 0); + } + if (failures > 0) { e(new Error(`${failures} tests failed.`)); } else { @@ -32,12 +34,9 @@ function run() { } }); } catch (err) { + console.error(err); e(err); } }); }); } - -module.exports = { - run -}; diff --git a/src/test/suite/removeProperty.test.ts b/src/test/suite/removeProperty.test.ts new file mode 100644 index 0000000..5b3eb10 --- /dev/null +++ b/src/test/suite/removeProperty.test.ts @@ -0,0 +1,108 @@ +import * as vscode from 'vscode'; +import * as path from 'path'; +import * as assert from 'assert'; +import * as fs from 'fs'; +import { waitToAssertInSeconds, delay, resetDefaultSettings } from './utils'; + +const testFolderRelativeLocation = '/../fixtures/remove/'; + +suite('Remove Property', function () { + setup(async () => { + await resetDefaultSettings(); + }); + + teardown(async () => { + await resetDefaultSettings(); + }); + + test('Should remove an existing property by name', async () => { + await runFixture('ConstructorWithMultipleProperties.php'); + }); + + test('Should remove the constructor method when the body is empty', async () => { + await runFixture('EmptyConstructor.php'); + }); + + test('Should remove the constructor method when the body is empty after removing the last property', async () => { + await runFixture('ConstructorWithSingleProperty.php'); + }); + + test('Should NOT remove the constructor method when the body is NOT empty after removing the last property', async () => { + await runFixture('ConstructorWithOneProperty.php'); + }); + + test('Should NOT remove the constructor argument when the property name does not match', async () => { + await runFixture('ConstructorWithOtherArgument.php'); + }); + + test('Should remove the constructor docblock along with the constructor', async () => { + await runFixture('ConstructorWithSinglePropertyAndDocblock.php'); + }); + + test('Should remove typed properties', async () => { + await runFixture('TypedProperty.php'); + }); + + test('Should remove the property docblock', async () => { + await runFixture('PropertyWithDocblock.php'); + }); + + test('Should remove the property from the constructor docblock', async () => { + await runFixture('ConstructorDocblock.php'); + }); + + test('Should remove a property when the cursor is placed in its statement', async () => { + await runFixture('ConstructorWithMultiplePropertiesCursorInPropertyStatement.php', new vscode.Position(11, 13)); + }); + + test('Should remove a property when the cursor is placed in its constructor argument', async () => { + await runFixture('ConstructorWithMultiplePropertiesCursorInArgument.php', new vscode.Position(13, 35)); + }); + + test('Should remove a property when the cursor is placed in its assignment', async () => { + await runFixture('ConstructorWithMultiplePropertiesCursorInAssignment.php', new vscode.Position(15, 18)); + }); + + test('Should remove a property when the cursor is placed in its constructor docblock', async () => { + await runFixture('ConstructorWithMultiplePropertiesCursorInConstructorDocblock.php', new vscode.Position(16, 24)); + }); +}); + +async function runFixture(fileName: string, cursorPosition?: vscode.Position) { + const uri = vscode.Uri.file( + getInputFilePath(fileName) + ); + const document = await vscode.workspace.openTextDocument(uri); + await vscode.window.showTextDocument(document); + + if (!vscode.window.activeTextEditor) { + return; + } + + if (cursorPosition === undefined) { + vscode.window.showInputBox = function ( + options?: vscode.InputBoxOptions | undefined, + token?: vscode.CancellationToken | undefined + ): Thenable { + return Promise.resolve('name'); + }; + } else { + vscode.window.activeTextEditor.selections = [new vscode.Selection(cursorPosition, cursorPosition)]; + } + + await vscode.commands.executeCommand('phpAddProperty.remove'); + + const expectedText = fs.readFileSync(getOutputFilePath(fileName)).toString(); + + await delay(waitToAssertInSeconds, () => { + assert.strictEqual(vscode.window.activeTextEditor?.document.getText(), expectedText); + }); +} + +function getInputFilePath(name: string) { + return path.join(__dirname + testFolderRelativeLocation + `inputs/${name}`); +} + +function getOutputFilePath(name: string) { + return path.join(__dirname + testFolderRelativeLocation + `outputs/${name}`); +} diff --git a/src/test/suite/renameProperty.test.ts b/src/test/suite/renameProperty.test.ts new file mode 100644 index 0000000..a5d1bbe --- /dev/null +++ b/src/test/suite/renameProperty.test.ts @@ -0,0 +1,106 @@ +import * as vscode from 'vscode'; +import * as path from 'path'; +import * as assert from 'assert'; +import * as fs from 'fs'; +import { waitToAssertInSeconds, delay, resetDefaultSettings } from './utils'; + +const testFolderRelativeLocation = '/../fixtures/rename/'; + +suite('Rename Property', function () { + setup(async () => { + await resetDefaultSettings(); + }); + + teardown(async () => { + await resetDefaultSettings(); + }); + + test('Should rename a property by name', async () => { + await runFixture('ConstructorWithMultipleProperties.php'); + }); + + test('Should rename a single property', async () => { + await runFixture('ConstructorWithSingleProperty.php'); + }); + + test('Should rename a property when the cursor is placed in its statement', async () => { + await runFixture('ConstructorWithMultiplePropertiesCursorInPropertyStatement.php', new vscode.Position(9, 13)); + }); + + test('Should rename a property when the cursor is placed in its constructor argument', async () => { + await runFixture('ConstructorWithMultiplePropertiesCursorInArgument.php', new vscode.Position(13, 50)); + }); + + test('Should rename a property when the cursor is placed in its assignment', async () => { + await runFixture('ConstructorWithMultiplePropertiesCursorInAssignment.php', new vscode.Position(16, 18)); + }); + + test('Should rename a property when the cursor is placed in its constructor docblock param', async () => { + await runFixture('ConstructorWithMultiplePropertiesCursorInConstructorDocblock.php', new vscode.Position(14, 10)); + }); + + test('Should rename all property references', async () => { + await runFixture('PropertyReferences.php'); + }); + + test('Should rename only one property when there are more than one properties per statement', async () => { + await runFixture('MultiplePropertyStatements.php'); + }); + + test('Should rename constructor param docblock', async () => { + await runFixture('ConstructorDocblock.php'); + }); +}); + +async function runFixture(fileName: string, cursorPosition?: vscode.Position) { + const uri = vscode.Uri.file( + getInputFilePath(fileName) + ); + const document = await vscode.workspace.openTextDocument(uri); + await vscode.window.showTextDocument(document); + + if (!vscode.window.activeTextEditor) { + return; + } + + if (cursorPosition === undefined) { + let first = true; + vscode.window.showInputBox = function ( + options?: vscode.InputBoxOptions | undefined, + token?: vscode.CancellationToken | undefined + ): Thenable { + if (first === true) { + first = false; + + return Promise.resolve('name'); + } + + return Promise.resolve('newName'); + }; + } else { + vscode.window.activeTextEditor.selections = [new vscode.Selection(cursorPosition, cursorPosition)]; + + vscode.window.showInputBox = function ( + options?: vscode.InputBoxOptions | undefined, + token?: vscode.CancellationToken | undefined + ): Thenable { + return Promise.resolve('newName'); + }; + } + + await vscode.commands.executeCommand('phpAddProperty.rename'); + + const expectedText = fs.readFileSync(getOutputFilePath(fileName)).toString(); + + await delay(waitToAssertInSeconds, () => { + assert.strictEqual(vscode.window.activeTextEditor?.document.getText(), expectedText); + }); +} + +function getInputFilePath(name: string) { + return path.join(__dirname + testFolderRelativeLocation + `inputs/${name}`); +} + +function getOutputFilePath(name: string) { + return path.join(__dirname + testFolderRelativeLocation + `outputs/${name}`); +} diff --git a/test/suite/utils.js b/src/test/suite/utils.ts similarity index 78% rename from test/suite/utils.js rename to src/test/suite/utils.ts index 72b4f43..19b7825 100644 --- a/test/suite/utils.js +++ b/src/test/suite/utils.ts @@ -1,10 +1,8 @@ -const vscode = require('vscode'); +import * as vscode from 'vscode'; -const waitToAssertInSeconds = 15; +export const waitToAssertInSeconds = 15; -exports.waitToAssertInSeconds = waitToAssertInSeconds; - -exports.delay = (seconds, callback) => { +export function delay(seconds: number, callback: Function) { return new Promise(resolve => { setTimeout(() => { callback(); @@ -13,8 +11,9 @@ exports.delay = (seconds, callback) => { }); } -exports.resetDefaultSettings = async () => { +export async function resetDefaultSettings() { const config = vscode.workspace.getConfiguration('phpAddProperty'); + for (const key in config) { if (config.hasOwnProperty(key)) { await setDefaultSetting(config, config[key], key); @@ -29,7 +28,7 @@ exports.resetDefaultSettings = async () => { } } -async function setDefaultSetting(config, value, parentKey) { +async function setDefaultSetting(config: vscode.WorkspaceConfiguration, value: any, parentKey: string) { if (typeof value === 'function') { return; } @@ -44,4 +43,4 @@ async function setDefaultSetting(config, value, parentKey) { setDefaultSetting(config, value[key], [parentKey, key].join('.')); } } -} \ No newline at end of file +} diff --git a/src/utils.ts b/src/utils.ts new file mode 100644 index 0000000..ba7c6b9 --- /dev/null +++ b/src/utils.ts @@ -0,0 +1,190 @@ +import * as vscode from 'vscode'; +import PhpEngine from 'php-parser'; +import { debugEnvName } from './constants'; + +export function getVisibilityChoice(defaultValue: string): string { + let visibilityChoices = ['public', 'protected', 'private']; + if (visibilityChoices.indexOf(defaultValue) !== -1) { + visibilityChoices.splice(visibilityChoices.indexOf(defaultValue), 1); + } + return `|${[defaultValue, ...visibilityChoices].join(',')}|`; +} + +function extractConstructorParts(text: string): RegExpExecArray | null { + const regex = /(.*__construct\s*)\(((?:\s|\S)*?)(?=\))\s*\)\s*{/; + const match = regex.exec(text); + + return match; +} + +function getMultilineConstructorText(text: string, functionDefinition: string, parametersText: string) { + const parameters = parametersText.split(',').map(parameter => indentText(parameter.trim(), 2)); + + const multilineConstructorText = functionDefinition + + '(\n' + + `${parameters.join(',\n')}\n` + + indentText(') {'); + + return text.replace(text, multilineConstructorText); +} + +export function breakConstructorIntoMultiline(text: string): string { + if (config('phpAddProperty.constructor.breakIntoMultilineIfLengthExceeded.enabled') !== true) { + return text; + } + + const match = extractConstructorParts(text); + + if (!match) { + return text; + } + + const constructorLineText = match[0]; + const maxLineLength = config('phpAddProperty.constructor.breakIntoMultilineIfLengthExceeded.maxLineLength') as Number; + + if (constructorLineText.length <= maxLineLength) { + return text; + } + + return text.replace(constructorLineText, getMultilineConstructorText(constructorLineText, match[1], match[2])); +} + +export function forceBreakConstructorIntoMultiline(text: string): string { + const match = extractConstructorParts(text); + + if (!match) { + return text; + } + + return text.replace(match[0], getMultilineConstructorText(match[0], match[1], match[2])); +} + +export function getPropertyNameFromLineText( + lineText: string, + document: vscode.TextDocument, + phpEngine: PhpEngine, + cursorPosition: vscode.Position +): string|undefined { + const paramRegex = /@param(?:\s+\S+)?\s+\$(\S+).*/; + + const matchParam = paramRegex.exec(lineText); + + if (matchParam) { + return matchParam[1]; + } else { + const lineAst = (phpEngine.parseEval(`class A { ${lineText} }`) as any); + + const selectedWord = document.getText(document.getWordRangeAtPosition(cursorPosition)).replace(/^\$/, ''); + + if (lineAst.children[0]?.body[0]?.kind === 'propertystatement') { + const properties = (lineAst.children[0].body[0].properties as any[]); + + const propertyAst = properties.find((propertyAst) => propertyAst.name?.name === selectedWord) ?? properties[0]; + let propertyName = propertyAst.name?.name; + + if (propertyName === 'this') { + const assignmentAst = (phpEngine.parseEval(`class A { public function __construct() { ${lineText} } }`) as any); + + if (assignmentAst.children[0]?.body[0]?.body?.children[0]?.kind === 'expressionstatement') { + propertyName = assignmentAst.children[0].body[0].body.children[0].expression.right?.name; + } + } + + return propertyName; + } else if (lineAst.children[0]?.body[0]?.kind === 'method') { + const constructorArgs = (lineAst.children[0].body[0].arguments as any[]); + + const argumentAst = constructorArgs.find((propertyAst) => propertyAst.name?.name === selectedWord) ?? constructorArgs[0]; + return argumentAst.name?.name; + } + } +} + +export function calculateIndentationLevel(index: number): number { + return Math.floor(index / configUsingResource('editor.tabSize')); +} + +export function getLineFirstNonIndentationCharacterIndex(lineText: string): number { + const tabSize = configUsingResource('editor.tabSize'); + + let index = 0; + for (let i = 0; i < lineText.length; i++) { + const char = lineText[i]; + + if (/[^\s\t]/.test(char)) { + index++; + break; + } + + index += char === "\t" ? tabSize : 1; + } + + return index; +} + +export function indentText(text: string, level: number = 1) { + /** + * Good to have + * Listen for view options changes and use these values + * https://github.com/jedmao/tabsanity-vs/blob/faa41a99ccb47c8e7717edfcbdfba4c093e670fe/TabSanity/TabOptionsListener.cs + */ + let tab = "\t"; + if (configUsingResource('editor.insertSpaces')) { + const tabSize = configUsingResource('editor.tabSize'); + tab = ' '.repeat(tabSize); + } + return tab.repeat(level) + text; +} + +export function configUsingResource(key: string): any { + const parts = key.split(/\.(.+)/, 2); + const configuration = vscode.workspace.getConfiguration( + parts[0], + vscode.window.activeTextEditor?.document.uri + ); + + return parts[1] ? configuration.get(parts[1]) : configuration; +} + +export function config(key: string) { + return vscode.workspace.getConfiguration().get(key); +} + +export function escapeForRegExp(text: string): string { + return text.replace(/[.*+\-?^${}()|[\]\\]/g, '\\$&'); +} + +export function escapeForSnippet(text: string): string { + return text.replace(/(? { + editBuilder.replace(range, "\n".repeat(rangeLines)); + }, + { + undoStopBefore: true, + undoStopAfter: false + } + ).then(() => { + const editor = vscode.window.activeTextEditor; + + if (editor) { + editor.insertSnippet( + new vscode.SnippetString(snippet), + range, + { + undoStopBefore: false, + undoStopAfter: false, + } + ); + } + }); +} + +export function isDebugMode() { + return process.env[debugEnvName] === "true"; +} diff --git a/test/runTest.js b/test/runTest.js deleted file mode 100644 index e355d77..0000000 --- a/test/runTest.js +++ /dev/null @@ -1,34 +0,0 @@ -const path = require('path'); - -const { runTests } = require('vscode-test'); - -async function main() { - try { - // The folder containing the Extension Manifest package.json - // Passed to `--extensionDevelopmentPath` - const extensionDevelopmentPath = path.resolve(__dirname, '../'); - - // The path to the extension test script - // Passed to --extensionTestsPath - const extensionTestsPath = path.resolve(__dirname, './suite/index'); - - const testUserDir = path.resolve(__dirname, './user'); - - // Download VS Code, unzip it and run the integration test - await runTests( - { - extensionDevelopmentPath, - extensionTestsPath, - launchArgs: [ - `--user-data-dir=${testUserDir}`, - '--disable-extensions' - ] - } - ); - } catch (err) { - console.error('Failed to run tests'); - process.exit(1); - } -} - -main(); diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..b65c745 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "outDir": "out", + "lib": [ + "es6" + ], + "sourceMap": true, + "rootDir": "src", + "strict": true /* enable all strict type-checking options */ + /* Additional Checks */ + // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ + // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + // "noUnusedParameters": true, /* Report errors on unused parameters. */ + }, + "exclude": [ + "node_modules", + ".vscode-test" + ] +} diff --git a/webviews/1.0.1/css/main.css b/webviews/1.0.1/css/main.css new file mode 100644 index 0000000..53b0427 --- /dev/null +++ b/webviews/1.0.1/css/main.css @@ -0,0 +1 @@ +/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}button{background-color:transparent;background-image:none}button:focus{outline:1px dotted;outline:5px auto -webkit-focus-ring-color}fieldset{margin:0;padding:0}ol,ul{list-style:none;margin:0;padding:0}html{font-family:Inter var,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";line-height:1.5}*,::after,::before{box-sizing:border-box;border-width:0;border-style:solid;border-color:#d2d6dc}hr{border-top-width:1px}img{border-style:solid}textarea{resize:vertical}input::placeholder,textarea::placeholder{color:#a0aec0}[role=button],button{cursor:pointer}table{border-collapse:collapse}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}button,input,optgroup,select,textarea{padding:0;line-height:inherit;color:inherit}code,kbd,pre,samp{font-family:Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}.form-input{appearance:none;background-color:#fff;border-color:#d2d6dc;border-width:1px;border-radius:.375rem;padding-top:.5rem;padding-right:.75rem;padding-bottom:.5rem;padding-left:.75rem;font-size:1rem;line-height:1.5}.form-input::placeholder{color:#9fa6b2;opacity:1}.form-input:focus{outline:0;box-shadow:0 0 0 3px rgba(164,202,254,.45);border-color:#a4cafe}.form-textarea{appearance:none;background-color:#fff;border-color:#d2d6dc;border-width:1px;border-radius:.375rem;padding-top:.5rem;padding-right:.75rem;padding-bottom:.5rem;padding-left:.75rem;font-size:1rem;line-height:1.5}.form-textarea::placeholder{color:#9fa6b2;opacity:1}.form-textarea:focus{outline:0;box-shadow:0 0 0 3px rgba(164,202,254,.45);border-color:#a4cafe}.form-multiselect{appearance:none;background-color:#fff;border-color:#d2d6dc;border-width:1px;border-radius:.375rem;padding-top:.5rem;padding-right:.75rem;padding-bottom:.5rem;padding-left:.75rem;font-size:1rem;line-height:1.5}.form-multiselect:focus{outline:0;box-shadow:0 0 0 3px rgba(164,202,254,.45);border-color:#a4cafe}.form-select{background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3e%3cpath d='M7 7l3-3 3 3m0 6l-3 3-3-3' stroke='%239fa6b2' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e");appearance:none;color-adjust:exact;background-repeat:no-repeat;background-color:#fff;border-color:#d2d6dc;border-width:1px;border-radius:.375rem;padding-top:.5rem;padding-right:2.5rem;padding-bottom:.5rem;padding-left:.75rem;font-size:1rem;line-height:1.5;background-position:right .5rem center;background-size:1.5em 1.5em}.form-select::-ms-expand{color:#9fa6b2;border:none}@media not print{.form-select::-ms-expand{display:none}}@media print and (-ms-high-contrast:active),print and (-ms-high-contrast:none){.form-select{padding-right:.75rem}}.form-select:focus{outline:0;box-shadow:0 0 0 3px rgba(164,202,254,.45);border-color:#a4cafe}.form-checkbox:checked{background-image:url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M5.707 7.293a1 1 0 0 0-1.414 1.414l2 2a1 1 0 0 0 1.414 0l4-4a1 1 0 0 0-1.414-1.414L7 8.586 5.707 7.293z'/%3e%3c/svg%3e");border-color:transparent;background-color:currentColor;background-size:100% 100%;background-position:center;background-repeat:no-repeat}@media not print{.form-checkbox::-ms-check{border-width:1px;color:transparent;background:inherit;border-color:inherit;border-radius:inherit}}.form-checkbox{appearance:none;color-adjust:exact;display:inline-block;vertical-align:middle;background-origin:border-box;user-select:none;flex-shrink:0;height:1rem;width:1rem;color:#3f83f8;background-color:#fff;border-color:#d2d6dc;border-width:1px;border-radius:.25rem}.form-checkbox:focus{outline:0;box-shadow:0 0 0 3px rgba(164,202,254,.45);border-color:#a4cafe}.form-checkbox:checked:focus{border-color:transparent}.form-radio:checked{background-image:url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='8' cy='8' r='3'/%3e%3c/svg%3e");border-color:transparent;background-color:currentColor;background-size:100% 100%;background-position:center;background-repeat:no-repeat}@media not print{.form-radio::-ms-check{border-width:1px;color:transparent;background:inherit;border-color:inherit;border-radius:inherit}}.form-radio{appearance:none;color-adjust:exact;display:inline-block;vertical-align:middle;background-origin:border-box;user-select:none;flex-shrink:0;border-radius:100%;height:1rem;width:1rem;color:#3f83f8;background-color:#fff;border-color:#d2d6dc;border-width:1px}.form-radio:focus{outline:0;box-shadow:0 0 0 3px rgba(164,202,254,.45);border-color:#a4cafe}.form-radio:checked:focus{border-color:transparent}.prose{color:#374151;max-width:65ch}.prose [class~=lead]{color:#4b5563;font-size:1.25em;line-height:1.6;margin-top:1.2em;margin-bottom:1.2em}.prose a{color:#5850ec;text-decoration:none;font-weight:600}.prose strong{color:#161e2e;font-weight:600}.prose ol{counter-reset:list-counter;margin-top:1.25em;margin-bottom:1.25em}.prose ol>li{position:relative;counter-increment:list-counter;padding-left:1.75em}.prose ol>li::before{content:counter(list-counter) ".";position:absolute;font-weight:400;color:#6b7280}.prose ul>li{position:relative;padding-left:1.75em}.prose ul>li::before{content:"";position:absolute;background-color:#d2d6dc;border-radius:50%;width:.375em;height:.375em;top:calc(.875em - .1875em);left:.25em}.prose hr{border-color:#e5e7eb;border-top-width:1px;margin-top:3em;margin-bottom:3em}.prose blockquote{font-weight:500;font-style:italic;color:#161e2e;border-left-width:.25rem;border-left-color:#e5e7eb;quotes:"\201C""\201D""\2018""\2019";margin-top:1.6em;margin-bottom:1.6em;padding-left:1em}.prose blockquote p:first-of-type::before{content:open-quote}.prose blockquote p:last-of-type::after{content:close-quote}.prose h1{color:#1a202c;font-weight:800;font-size:2.25em;margin-top:0;margin-bottom:.8888889em;line-height:1.1111111}.prose h2{color:#1a202c;font-weight:700;font-size:1.5em;margin-top:2em;margin-bottom:1em;line-height:1.3333333}.prose h3{color:#1a202c;font-weight:600;font-size:1.25em;margin-top:1.6em;margin-bottom:.6em;line-height:1.6}.prose h4{color:#1a202c;font-weight:600;margin-top:1.5em;margin-bottom:.5em;line-height:1.5}.prose figure figcaption{color:#6b7280;font-size:.875em;line-height:1.4285714;margin-top:.8571429em}.prose code{color:#161e2e;font-weight:600;font-size:.875em}.prose code::before{content:"`"}.prose code::after{content:"`"}.prose pre{color:#e5e7eb;background-color:#252f3f;overflow-x:auto;font-size:.875em;line-height:1.7142857;margin-top:1.7142857em;margin-bottom:1.7142857em;border-radius:.375rem;padding-top:.8571429em;padding-right:1.1428571em;padding-bottom:.8571429em;padding-left:1.1428571em}.prose pre code{background-color:transparent;border-width:0;border-radius:0;padding:0;font-weight:400;color:inherit;font-size:inherit;font-family:inherit;line-height:inherit}.prose pre code::before{content:""}.prose pre code::after{content:""}.prose table{width:100%;table-layout:auto;text-align:left;margin-top:2em;margin-bottom:2em;font-size:.875em;line-height:1.7142857}.prose thead{color:#161e2e;font-weight:600;border-bottom-width:1px;border-bottom-color:#d2d6dc}.prose thead th{vertical-align:bottom;padding-right:.5714286em;padding-bottom:.5714286em;padding-left:.5714286em}.prose tbody tr{border-bottom-width:1px;border-bottom-color:#e5e7eb}.prose tbody tr:last-child{border-bottom-width:0}.prose tbody td{vertical-align:top;padding-top:.5714286em;padding-right:.5714286em;padding-bottom:.5714286em;padding-left:.5714286em}.prose{font-size:1rem;line-height:1.75}.prose p{margin-top:1.25em;margin-bottom:1.25em}.prose img{margin-top:2em;margin-bottom:2em}.prose video{margin-top:2em;margin-bottom:2em}.prose figure{margin-top:2em;margin-bottom:2em}.prose figure>*{margin-top:0;margin-bottom:0}.prose h2 code{font-size:.875em}.prose h3 code{font-size:.9em}.prose ul{margin-top:1.25em;margin-bottom:1.25em}.prose li{margin-top:.5em;margin-bottom:.5em}.prose ol>li:before{left:0}.prose>ul>li p{margin-top:.75em;margin-bottom:.75em}.prose>ul>li>:first-child{margin-top:1.25em}.prose>ul>li>:last-child{margin-bottom:1.25em}.prose>ol>li>:first-child{margin-top:1.25em}.prose>ol>li>:last-child{margin-bottom:1.25em}.prose ol ol,.prose ol ul,.prose ul ol,.prose ul ul{margin-top:.75em;margin-bottom:.75em}.prose hr+*{margin-top:0}.prose h2+*{margin-top:0}.prose h3+*{margin-top:0}.prose h4+*{margin-top:0}.prose thead th:first-child{padding-left:0}.prose thead th:last-child{padding-right:0}.prose tbody td:first-child{padding-left:0}.prose tbody td:last-child{padding-right:0}.prose>:first-child{margin-top:0}.prose>:last-child{margin-bottom:0}.prose h1,.prose h2,.prose h3,.prose h4{color:#161e2e}.prose-sm{font-size:.875rem;line-height:1.7142857}.prose-sm p{margin-top:1.1428571em;margin-bottom:1.1428571em}.prose-sm [class~=lead]{font-size:1.2857143em;line-height:1.5555556;margin-top:.8888889em;margin-bottom:.8888889em}.prose-sm blockquote{margin-top:1.3333333em;margin-bottom:1.3333333em;padding-left:1.1111111em}.prose-sm h1{font-size:2.1428571em;margin-top:0;margin-bottom:.8em;line-height:1.2}.prose-sm h2{font-size:1.4285714em;margin-top:1.6em;margin-bottom:.8em;line-height:1.4}.prose-sm h3{font-size:1.2857143em;margin-top:1.5555556em;margin-bottom:.4444444em;line-height:1.5555556}.prose-sm h4{margin-top:1.4285714em;margin-bottom:.5714286em;line-height:1.4285714}.prose-sm img{margin-top:1.7142857em;margin-bottom:1.7142857em}.prose-sm video{margin-top:1.7142857em;margin-bottom:1.7142857em}.prose-sm figure{margin-top:1.7142857em;margin-bottom:1.7142857em}.prose-sm figure>*{margin-top:0;margin-bottom:0}.prose-sm figure figcaption{font-size:.8571429em;line-height:1.3333333;margin-top:.6666667em}.prose-sm code{font-size:.8571429em}.prose-sm h2 code{font-size:.9em}.prose-sm h3 code{font-size:.8888889em}.prose-sm pre{font-size:.8571429em;line-height:1.6666667;margin-top:1.6666667em;margin-bottom:1.6666667em;border-radius:.25rem;padding-top:.6666667em;padding-right:1em;padding-bottom:.6666667em;padding-left:1em}.prose-sm ol{margin-top:1.1428571em;margin-bottom:1.1428571em}.prose-sm ul{margin-top:1.1428571em;margin-bottom:1.1428571em}.prose-sm li{margin-top:.2857143em;margin-bottom:.2857143em}.prose-sm ol>li{padding-left:1.5714286em}.prose-sm ol>li:before{left:0}.prose-sm ul>li{padding-left:1.5714286em}.prose-sm ul>li::before{height:.3571429em;width:.3571429em;top:calc(.8571429em - .1785714em);left:.2142857em}.prose-sm>ul>li p{margin-top:.5714286em;margin-bottom:.5714286em}.prose-sm>ul>li>:first-child{margin-top:1.1428571em}.prose-sm>ul>li>:last-child{margin-bottom:1.1428571em}.prose-sm>ol>li>:first-child{margin-top:1.1428571em}.prose-sm>ol>li>:last-child{margin-bottom:1.1428571em}.prose-sm ol ol,.prose-sm ol ul,.prose-sm ul ol,.prose-sm ul ul{margin-top:.5714286em;margin-bottom:.5714286em}.prose-sm hr{margin-top:2.8571429em;margin-bottom:2.8571429em}.prose-sm hr+*{margin-top:0}.prose-sm h2+*{margin-top:0}.prose-sm h3+*{margin-top:0}.prose-sm h4+*{margin-top:0}.prose-sm table{font-size:.8571429em;line-height:1.5}.prose-sm thead th{padding-right:1em;padding-bottom:.6666667em;padding-left:1em}.prose-sm thead th:first-child{padding-left:0}.prose-sm thead th:last-child{padding-right:0}.prose-sm tbody td{padding-top:.6666667em;padding-right:1em;padding-bottom:.6666667em;padding-left:1em}.prose-sm tbody td:first-child{padding-left:0}.prose-sm tbody td:last-child{padding-right:0}.prose-sm>:first-child{margin-top:0}.prose-sm>:last-child{margin-bottom:0}.prose-lg{font-size:1.125rem;line-height:1.7777778}.prose-lg p{margin-top:1.3333333em;margin-bottom:1.3333333em}.prose-lg [class~=lead]{font-size:1.2222222em;line-height:1.4545455;margin-top:1.0909091em;margin-bottom:1.0909091em}.prose-lg blockquote{margin-top:1.6666667em;margin-bottom:1.6666667em;padding-left:1em}.prose-lg h1{font-size:2.6666667em;margin-top:0;margin-bottom:.8333333em;line-height:1}.prose-lg h2{font-size:1.6666667em;margin-top:1.8666667em;margin-bottom:1.0666667em;line-height:1.3333333}.prose-lg h3{font-size:1.3333333em;margin-top:1.6666667em;margin-bottom:.6666667em;line-height:1.5}.prose-lg h4{margin-top:1.7777778em;margin-bottom:.4444444em;line-height:1.5555556}.prose-lg img{margin-top:1.7777778em;margin-bottom:1.7777778em}.prose-lg video{margin-top:1.7777778em;margin-bottom:1.7777778em}.prose-lg figure{margin-top:1.7777778em;margin-bottom:1.7777778em}.prose-lg figure>*{margin-top:0;margin-bottom:0}.prose-lg figure figcaption{font-size:.8888889em;line-height:1.5;margin-top:1em}.prose-lg code{font-size:.8888889em}.prose-lg h2 code{font-size:.8666667em}.prose-lg h3 code{font-size:.875em}.prose-lg pre{font-size:.8888889em;line-height:1.75;margin-top:2em;margin-bottom:2em;border-radius:.375rem;padding-top:1em;padding-right:1.5em;padding-bottom:1em;padding-left:1.5em}.prose-lg ol{margin-top:1.3333333em;margin-bottom:1.3333333em}.prose-lg ul{margin-top:1.3333333em;margin-bottom:1.3333333em}.prose-lg li{margin-top:.6666667em;margin-bottom:.6666667em}.prose-lg ol>li{padding-left:1.6666667em}.prose-lg ol>li:before{left:0}.prose-lg ul>li{padding-left:1.6666667em}.prose-lg ul>li::before{width:.3333333em;height:.3333333em;top:calc(.8888889em - .1666667em);left:.2222222em}.prose-lg>ul>li p{margin-top:.8888889em;margin-bottom:.8888889em}.prose-lg>ul>li>:first-child{margin-top:1.3333333em}.prose-lg>ul>li>:last-child{margin-bottom:1.3333333em}.prose-lg>ol>li>:first-child{margin-top:1.3333333em}.prose-lg>ol>li>:last-child{margin-bottom:1.3333333em}.prose-lg ol ol,.prose-lg ol ul,.prose-lg ul ol,.prose-lg ul ul{margin-top:.8888889em;margin-bottom:.8888889em}.prose-lg hr{margin-top:3.1111111em;margin-bottom:3.1111111em}.prose-lg hr+*{margin-top:0}.prose-lg h2+*{margin-top:0}.prose-lg h3+*{margin-top:0}.prose-lg h4+*{margin-top:0}.prose-lg table{font-size:.8888889em;line-height:1.5}.prose-lg thead th{padding-right:.75em;padding-bottom:.75em;padding-left:.75em}.prose-lg thead th:first-child{padding-left:0}.prose-lg thead th:last-child{padding-right:0}.prose-lg tbody td{padding-top:.75em;padding-right:.75em;padding-bottom:.75em;padding-left:.75em}.prose-lg tbody td:first-child{padding-left:0}.prose-lg tbody td:last-child{padding-right:0}.prose-lg>:first-child{margin-top:0}.prose-lg>:last-child{margin-bottom:0}.prose-xl{font-size:1.25rem;line-height:1.8}.prose-xl p{margin-top:1.2em;margin-bottom:1.2em}.prose-xl [class~=lead]{font-size:1.2em;line-height:1.5;margin-top:1em;margin-bottom:1em}.prose-xl blockquote{margin-top:1.6em;margin-bottom:1.6em;padding-left:1.0666667em}.prose-xl h1{font-size:2.8em;margin-top:0;margin-bottom:.8571429em;line-height:1}.prose-xl h2{font-size:1.8em;margin-top:1.5555556em;margin-bottom:.8888889em;line-height:1.1111111}.prose-xl h3{font-size:1.5em;margin-top:1.6em;margin-bottom:.6666667em;line-height:1.3333333}.prose-xl h4{margin-top:1.8em;margin-bottom:.6em;line-height:1.6}.prose-xl img{margin-top:2em;margin-bottom:2em}.prose-xl video{margin-top:2em;margin-bottom:2em}.prose-xl figure{margin-top:2em;margin-bottom:2em}.prose-xl figure>*{margin-top:0;margin-bottom:0}.prose-xl figure figcaption{font-size:.9em;line-height:1.5555556;margin-top:1em}.prose-xl code{font-size:.9em}.prose-xl h2 code{font-size:.8611111em}.prose-xl h3 code{font-size:.9em}.prose-xl pre{font-size:.9em;line-height:1.7777778;margin-top:2em;margin-bottom:2em;border-radius:.5rem;padding-top:1.1111111em;padding-right:1.3333333em;padding-bottom:1.1111111em;padding-left:1.3333333em}.prose-xl ol{margin-top:1.2em;margin-bottom:1.2em}.prose-xl ul{margin-top:1.2em;margin-bottom:1.2em}.prose-xl li{margin-top:.6em;margin-bottom:.6em}.prose-xl ol>li{padding-left:1.8em}.prose-xl ol>li:before{left:0}.prose-xl ul>li{padding-left:1.8em}.prose-xl ul>li::before{width:.35em;height:.35em;top:calc(.9em - .175em);left:.25em}.prose-xl>ul>li p{margin-top:.8em;margin-bottom:.8em}.prose-xl>ul>li>:first-child{margin-top:1.2em}.prose-xl>ul>li>:last-child{margin-bottom:1.2em}.prose-xl>ol>li>:first-child{margin-top:1.2em}.prose-xl>ol>li>:last-child{margin-bottom:1.2em}.prose-xl ol ol,.prose-xl ol ul,.prose-xl ul ol,.prose-xl ul ul{margin-top:.8em;margin-bottom:.8em}.prose-xl hr{margin-top:2.8em;margin-bottom:2.8em}.prose-xl hr+*{margin-top:0}.prose-xl h2+*{margin-top:0}.prose-xl h3+*{margin-top:0}.prose-xl h4+*{margin-top:0}.prose-xl table{font-size:.9em;line-height:1.5555556}.prose-xl thead th{padding-right:.6666667em;padding-bottom:.8888889em;padding-left:.6666667em}.prose-xl thead th:first-child{padding-left:0}.prose-xl thead th:last-child{padding-right:0}.prose-xl tbody td{padding-top:.8888889em;padding-right:.6666667em;padding-bottom:.8888889em;padding-left:.6666667em}.prose-xl tbody td:first-child{padding-left:0}.prose-xl tbody td:last-child{padding-right:0}.prose-xl>:first-child{margin-top:0}.prose-xl>:last-child{margin-bottom:0}.prose-2xl{font-size:1.5rem;line-height:1.6666667}.prose-2xl p{margin-top:1.3333333em;margin-bottom:1.3333333em}.prose-2xl [class~=lead]{font-size:1.25em;line-height:1.4666667;margin-top:1.0666667em;margin-bottom:1.0666667em}.prose-2xl blockquote{margin-top:1.7777778em;margin-bottom:1.7777778em;padding-left:1.1111111em}.prose-2xl h1{font-size:2.6666667em;margin-top:0;margin-bottom:.875em;line-height:1}.prose-2xl h2{font-size:2em;margin-top:1.5em;margin-bottom:.8333333em;line-height:1.0833333}.prose-2xl h3{font-size:1.5em;margin-top:1.5555556em;margin-bottom:.6666667em;line-height:1.2222222}.prose-2xl h4{margin-top:1.6666667em;margin-bottom:.6666667em;line-height:1.5}.prose-2xl img{margin-top:2em;margin-bottom:2em}.prose-2xl video{margin-top:2em;margin-bottom:2em}.prose-2xl figure{margin-top:2em;margin-bottom:2em}.prose-2xl figure>*{margin-top:0;margin-bottom:0}.prose-2xl figure figcaption{font-size:.8333333em;line-height:1.6;margin-top:1em}.prose-2xl code{font-size:.8333333em}.prose-2xl h2 code{font-size:.875em}.prose-2xl h3 code{font-size:.8888889em}.prose-2xl pre{font-size:.8333333em;line-height:1.8;margin-top:2em;margin-bottom:2em;border-radius:.5rem;padding-top:1.2em;padding-right:1.6em;padding-bottom:1.2em;padding-left:1.6em}.prose-2xl ol{margin-top:1.3333333em;margin-bottom:1.3333333em}.prose-2xl ul{margin-top:1.3333333em;margin-bottom:1.3333333em}.prose-2xl li{margin-top:.5em;margin-bottom:.5em}.prose-2xl ol>li{padding-left:1.6666667em}.prose-2xl ol>li:before{left:0}.prose-2xl ul>li{padding-left:1.6666667em}.prose-2xl ul>li::before{width:.3333333em;height:.3333333em;top:calc(.8333333em - .1666667em);left:.25em}.prose-2xl>ul>li p{margin-top:.8333333em;margin-bottom:.8333333em}.prose-2xl>ul>li>:first-child{margin-top:1.3333333em}.prose-2xl>ul>li>:last-child{margin-bottom:1.3333333em}.prose-2xl>ol>li>:first-child{margin-top:1.3333333em}.prose-2xl>ol>li>:last-child{margin-bottom:1.3333333em}.prose-2xl ol ol,.prose-2xl ol ul,.prose-2xl ul ol,.prose-2xl ul ul{margin-top:.6666667em;margin-bottom:.6666667em}.prose-2xl hr{margin-top:3em;margin-bottom:3em}.prose-2xl hr+*{margin-top:0}.prose-2xl h2+*{margin-top:0}.prose-2xl h3+*{margin-top:0}.prose-2xl h4+*{margin-top:0}.prose-2xl table{font-size:.8333333em;line-height:1.4}.prose-2xl thead th{padding-right:.6em;padding-bottom:.8em;padding-left:.6em}.prose-2xl thead th:first-child{padding-left:0}.prose-2xl thead th:last-child{padding-right:0}.prose-2xl tbody td{padding-top:.8em;padding-right:.6em;padding-bottom:.8em;padding-left:.6em}.prose-2xl tbody td:first-child{padding-left:0}.prose-2xl tbody td:last-child{padding-right:0}.prose-2xl>:first-child{margin-top:0}.prose-2xl>:last-child{margin-bottom:0}.space-x-2>:not(template)~:not(template){--space-x-reverse:0;margin-right:calc(.5rem * var(--space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--space-x-reverse)))}.space-y-4>:not(template)~:not(template){--space-y-reverse:0;margin-top:calc(1rem * calc(1 - var(--space-y-reverse)));margin-bottom:calc(1rem * var(--space-y-reverse))}.space-y-10>:not(template)~:not(template){--space-y-reverse:0;margin-top:calc(2.5rem * calc(1 - var(--space-y-reverse)));margin-bottom:calc(2.5rem * var(--space-y-reverse))}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.bg-white{--bg-opacity:1;background-color:#fff;background-color:rgba(255,255,255,var(--bg-opacity))}.bg-gray-50{--bg-opacity:1;background-color:#f9fafb;background-color:rgba(249,250,251,var(--bg-opacity))}.bg-gray-700{--bg-opacity:1;background-color:#374151;background-color:rgba(55,65,81,var(--bg-opacity))}.bg-gray-800{--bg-opacity:1;background-color:#252f3f;background-color:rgba(37,47,63,var(--bg-opacity))}.bg-gray-900{--bg-opacity:1;background-color:#161e2e;background-color:rgba(22,30,46,var(--bg-opacity))}.bg-green-600{--bg-opacity:1;background-color:#057a55;background-color:rgba(5,122,85,var(--bg-opacity))}.bg-indigo-200{--bg-opacity:1;background-color:#cddbfe;background-color:rgba(205,219,254,var(--bg-opacity))}.bg-indigo-600{--bg-opacity:1;background-color:#5850ec;background-color:rgba(88,80,236,var(--bg-opacity))}.bg-purple-500{--bg-opacity:1;background-color:#9061f9;background-color:rgba(144,97,249,var(--bg-opacity))}.hover\:bg-gray-600:hover{--bg-opacity:1;background-color:#4b5563;background-color:rgba(75,85,99,var(--bg-opacity))}.hover\:bg-gray-700:hover{--bg-opacity:1;background-color:#374151;background-color:rgba(55,65,81,var(--bg-opacity))}.hover\:bg-gray-800:hover{--bg-opacity:1;background-color:#252f3f;background-color:rgba(37,47,63,var(--bg-opacity))}.hover\:bg-green-500:hover{--bg-opacity:1;background-color:#0e9f6e;background-color:rgba(14,159,110,var(--bg-opacity))}.hover\:bg-indigo-500:hover{--bg-opacity:1;background-color:#6875f5;background-color:rgba(104,117,245,var(--bg-opacity))}.active\:bg-gray-50:active{--bg-opacity:1;background-color:#f9fafb;background-color:rgba(249,250,251,var(--bg-opacity))}.active\:bg-gray-600:active{--bg-opacity:1;background-color:#4b5563;background-color:rgba(75,85,99,var(--bg-opacity))}.active\:bg-green-500:active{--bg-opacity:1;background-color:#0e9f6e;background-color:rgba(14,159,110,var(--bg-opacity))}.border-transparent{border-color:transparent}.border-white{--border-opacity:1;border-color:#fff;border-color:rgba(255,255,255,var(--border-opacity))}.border-gray-200{--border-opacity:1;border-color:#e5e7eb;border-color:rgba(229,231,235,var(--border-opacity))}.border-gray-300{--border-opacity:1;border-color:#d2d6dc;border-color:rgba(210,214,220,var(--border-opacity))}.border-indigo-600{--border-opacity:1;border-color:#5850ec;border-color:rgba(88,80,236,var(--border-opacity))}.focus\:border-gray-700:focus{--border-opacity:1;border-color:#374151;border-color:rgba(55,65,81,var(--border-opacity))}.focus\:border-red-300:focus{--border-opacity:1;border-color:#f8b4b4;border-color:rgba(248,180,180,var(--border-opacity))}.focus\:border-green-700:focus{--border-opacity:1;border-color:#046c4e;border-color:rgba(4,108,78,var(--border-opacity))}.focus\:border-blue-300:focus{--border-opacity:1;border-color:#a4cafe;border-color:rgba(164,202,254,var(--border-opacity))}.focus\:border-indigo-700:focus{--border-opacity:1;border-color:#5145cd;border-color:rgba(81,69,205,var(--border-opacity))}.rounded{border-radius:.25rem}.rounded-md{border-radius:.375rem}.rounded-lg{border-radius:.5rem}.rounded-full{border-radius:9999px}.border-2{border-width:2px}.border-4{border-width:4px}.border{border-width:1px}.border-t-2{border-top-width:2px}.block{display:block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.hidden{display:none}.flex-col{flex-direction:column}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-start{justify-content:flex-start}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.flex-1{flex:1 1 0%}.flex-auto{flex:1 1 auto}.flex-shrink-0{flex-shrink:0}.clearfix:after{content:"";display:table;clear:both}.font-normal{font-weight:400}.font-medium{font-weight:500}.font-semibold{font-weight:600}.font-bold{font-weight:700}.font-extrabold{font-weight:800}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-8{height:2rem}.h-12{height:3rem}.h-24{height:6rem}.h-32{height:8rem}.h-5\/6{height:83.333333%}.text-sm{font-size:.875rem}.text-base{font-size:1rem}.text-lg{font-size:1.125rem}.text-xl{font-size:1.25rem}.text-2xl{font-size:1.5rem}.text-3xl{font-size:1.875rem}.leading-4{line-height:1rem}.leading-5{line-height:1.25rem}.leading-6{line-height:1.5rem}.leading-7{line-height:1.75rem}.leading-8{line-height:2rem}.leading-9{line-height:2.25rem}.leading-normal{line-height:1.5}.leading-loose{line-height:2}.mx-auto{margin-left:auto;margin-right:auto}.-mx-4{margin-left:-1rem;margin-right:-1rem}.mt-1{margin-top:.25rem}.mr-1{margin-right:.25rem}.mt-2{margin-top:.5rem}.mr-2{margin-right:.5rem}.ml-2{margin-left:.5rem}.mt-3{margin-top:.75rem}.ml-3{margin-left:.75rem}.mt-4{margin-top:1rem}.ml-4{margin-left:1rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.mt-10{margin-top:2.5rem}.mt-12{margin-top:3rem}.mt-14{margin-top:3.5rem}.mt-16{margin-top:4rem}.-ml-0\.5{margin-left:-.125rem}.max-w-md{max-width:28rem}.max-w-lg{max-width:32rem}.max-w-xl{max-width:36rem}.max-w-3xl{max-width:48rem}.max-w-6xl{max-width:72rem}.max-w-screen-lg{max-width:1024px}.max-w-screen-xl{max-width:1280px}.focus\:outline-none:focus{outline:0}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.px-3{padding-left:.75rem;padding-right:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.px-4{padding-left:1rem;padding-right:1rem}.py-5{padding-top:1.25rem;padding-bottom:1.25rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.py-10{padding-top:2.5rem;padding-bottom:2.5rem}.py-12{padding-top:3rem;padding-bottom:3rem}.pr-4{padding-right:1rem}.pt-6{padding-top:1.5rem}.pb-10{padding-bottom:2.5rem}.pt-12{padding-top:3rem}.pb-12{padding-bottom:3rem}.pb-16{padding-bottom:4rem}.pointer-events-none{pointer-events:none}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{top:0;right:0;bottom:0;left:0}.inset-x-0{right:0;left:0}.top-0{top:0}.right-0{right:0}.bottom-0{bottom:0}.left-0{left:0}.left-1\/2{left:50%}.right-full{right:100%}.left-full{left:100%}.shadow-sm{box-shadow:0 1px 2px 0 rgba(0,0,0,.05)}.shadow{box-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px 0 rgba(0,0,0,.06)}.shadow-md{box-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -1px rgba(0,0,0,.06)}.shadow-lg{box-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -2px rgba(0,0,0,.05)}.shadow-xl{box-shadow:0 20px 25px -5px rgba(0,0,0,.1),0 10px 10px -5px rgba(0,0,0,.04)}.focus\:shadow-outline:focus{box-shadow:0 0 0 3px rgba(118,169,250,.45)}.focus\:shadow-outline-blue:focus{box-shadow:0 0 0 3px rgba(164,202,254,.45)}.focus\:shadow-outline-red:focus{box-shadow:0 0 0 3px rgba(248,180,180,.45)}.focus\:shadow-outline-indigo:focus{box-shadow:0 0 0 3px rgba(180,198,252,.45)}.text-center{text-align:center}.text-white{--text-opacity:1;color:#fff;color:rgba(255,255,255,var(--text-opacity))}.text-black{--text-opacity:1;color:#000;color:rgba(0,0,0,var(--text-opacity))}.text-gray-200{--text-opacity:1;color:#e5e7eb;color:rgba(229,231,235,var(--text-opacity))}.text-gray-300{--text-opacity:1;color:#d2d6dc;color:rgba(210,214,220,var(--text-opacity))}.text-gray-500{--text-opacity:1;color:#6b7280;color:rgba(107,114,128,var(--text-opacity))}.text-gray-600{--text-opacity:1;color:#4b5563;color:rgba(75,85,99,var(--text-opacity))}.text-gray-700{--text-opacity:1;color:#374151;color:rgba(55,65,81,var(--text-opacity))}.text-gray-900{--text-opacity:1;color:#161e2e;color:rgba(22,30,46,var(--text-opacity))}.text-red-600{--text-opacity:1;color:#e02424;color:rgba(224,36,36,var(--text-opacity))}.text-orange-300{--text-opacity:1;color:#fdba8c;color:rgba(253,186,140,var(--text-opacity))}.text-green-400{--text-opacity:1;color:#31c48d;color:rgba(49,196,141,var(--text-opacity))}.text-indigo-200{--text-opacity:1;color:#cddbfe;color:rgba(205,219,254,var(--text-opacity))}.text-indigo-300{--text-opacity:1;color:#b4c6fc;color:rgba(180,198,252,var(--text-opacity))}.text-indigo-600{--text-opacity:1;color:#5850ec;color:rgba(88,80,236,var(--text-opacity))}.text-indigo-800{--text-opacity:1;color:#42389d;color:rgba(66,56,157,var(--text-opacity))}.hover\:text-white:hover{--text-opacity:1;color:#fff;color:rgba(255,255,255,var(--text-opacity))}.hover\:text-gray-500:hover{--text-opacity:1;color:#6b7280;color:rgba(107,114,128,var(--text-opacity))}.hover\:text-red-500:hover{--text-opacity:1;color:#f05252;color:rgba(240,82,82,var(--text-opacity))}.active\:text-gray-800:active{--text-opacity:1;color:#252f3f;color:rgba(37,47,63,var(--text-opacity))}.active\:text-red-700:active{--text-opacity:1;color:#c81e1e;color:rgba(200,30,30,var(--text-opacity))}.uppercase{text-transform:uppercase}.underline{text-decoration:underline}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.tracking-tight{letter-spacing:-.025em}.tracking-wider{letter-spacing:.05em}.w-0{width:0}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-12{width:3rem}.w-24{width:6rem}.w-32{width:8rem}.w-auto{width:auto}.w-full{width:100%}.z-0{z-index:0}.z-10{z-index:10}.transform{--transform-translate-x:0;--transform-translate-y:0;--transform-rotate:0;--transform-skew-x:0;--transform-skew-y:0;--transform-scale-x:1;--transform-scale-y:1;transform:translateX(var(--transform-translate-x)) translateY(var(--transform-translate-y)) rotate(var(--transform-rotate)) skewX(var(--transform-skew-x)) skewY(var(--transform-skew-y)) scaleX(var(--transform-scale-x)) scaleY(var(--transform-scale-y))}.translate-x-1\/2{--transform-translate-x:50%}.-translate-x-1\/2{--transform-translate-x:-50%}.translate-y-12{--transform-translate-y:3rem}.translate-y-16{--transform-translate-y:4rem}.translate-y-px{--transform-translate-y:1px}.-translate-y-1\/2{--transform-translate-y:-50%}.-translate-y-1\/4{--transform-translate-y:-25%}.transition{transition-property:background-color,border-color,color,fill,stroke,opacity,box-shadow,transform}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.duration-100{transition-duration:.1s}.duration-150{transition-duration:150ms}@keyframes spin{from{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes ping{0%{transform:scale(1);opacity:1}100%,75%{transform:scale(2);opacity:0}}@keyframes pulse{0%,100%{opacity:1}50%{opacity:.5}}@keyframes bounce{0%,100%{transform:translateY(-25%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:translateY(0);animation-timing-function:cubic-bezier(0,0,.2,1)}}.group:hover .group-hover\:animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@media (min-width:640px){.sm\:container{width:100%}@media (min-width:640px){.sm\:container{max-width:640px}}@media (min-width:768px){.sm\:container{max-width:768px}}@media (min-width:1024px){.sm\:container{max-width:1024px}}@media (min-width:1280px){.sm\:container{max-width:1280px}}.sm\:prose{color:#374151;max-width:65ch}.sm\:prose [class~=lead]{color:#4b5563;font-size:1.25em;line-height:1.6;margin-top:1.2em;margin-bottom:1.2em}.sm\:prose a{color:#5850ec;text-decoration:none;font-weight:600}.sm\:prose strong{color:#161e2e;font-weight:600}.sm\:prose ol{counter-reset:list-counter;margin-top:1.25em;margin-bottom:1.25em}.sm\:prose ol>li{position:relative;counter-increment:list-counter;padding-left:1.75em}.sm\:prose ol>li::before{content:counter(list-counter) ".";position:absolute;font-weight:400;color:#6b7280}.sm\:prose ul>li{position:relative;padding-left:1.75em}.sm\:prose ul>li::before{content:"";position:absolute;background-color:#d2d6dc;border-radius:50%;width:.375em;height:.375em;top:calc(.875em - .1875em);left:.25em}.sm\:prose hr{border-color:#e5e7eb;border-top-width:1px;margin-top:3em;margin-bottom:3em}.sm\:prose blockquote{font-weight:500;font-style:italic;color:#161e2e;border-left-width:.25rem;border-left-color:#e5e7eb;quotes:"\201C""\201D""\2018""\2019";margin-top:1.6em;margin-bottom:1.6em;padding-left:1em}.sm\:prose blockquote p:first-of-type::before{content:open-quote}.sm\:prose blockquote p:last-of-type::after{content:close-quote}.sm\:prose h1{color:#1a202c;font-weight:800;font-size:2.25em;margin-top:0;margin-bottom:.8888889em;line-height:1.1111111}.sm\:prose h2{color:#1a202c;font-weight:700;font-size:1.5em;margin-top:2em;margin-bottom:1em;line-height:1.3333333}.sm\:prose h3{color:#1a202c;font-weight:600;font-size:1.25em;margin-top:1.6em;margin-bottom:.6em;line-height:1.6}.sm\:prose h4{color:#1a202c;font-weight:600;margin-top:1.5em;margin-bottom:.5em;line-height:1.5}.sm\:prose figure figcaption{color:#6b7280;font-size:.875em;line-height:1.4285714;margin-top:.8571429em}.sm\:prose code{color:#161e2e;font-weight:600;font-size:.875em}.sm\:prose code::before{content:"`"}.sm\:prose code::after{content:"`"}.sm\:prose pre{color:#e5e7eb;background-color:#252f3f;overflow-x:auto;font-size:.875em;line-height:1.7142857;margin-top:1.7142857em;margin-bottom:1.7142857em;border-radius:.375rem;padding-top:.8571429em;padding-right:1.1428571em;padding-bottom:.8571429em;padding-left:1.1428571em}.sm\:prose pre code{background-color:transparent;border-width:0;border-radius:0;padding:0;font-weight:400;color:inherit;font-size:inherit;font-family:inherit;line-height:inherit}.sm\:prose pre code::before{content:""}.sm\:prose pre code::after{content:""}.sm\:prose table{width:100%;table-layout:auto;text-align:left;margin-top:2em;margin-bottom:2em;font-size:.875em;line-height:1.7142857}.sm\:prose thead{color:#161e2e;font-weight:600;border-bottom-width:1px;border-bottom-color:#d2d6dc}.sm\:prose thead th{vertical-align:bottom;padding-right:.5714286em;padding-bottom:.5714286em;padding-left:.5714286em}.sm\:prose tbody tr{border-bottom-width:1px;border-bottom-color:#e5e7eb}.sm\:prose tbody tr:last-child{border-bottom-width:0}.sm\:prose tbody td{vertical-align:top;padding-top:.5714286em;padding-right:.5714286em;padding-bottom:.5714286em;padding-left:.5714286em}.sm\:prose{font-size:1rem;line-height:1.75}.sm\:prose p{margin-top:1.25em;margin-bottom:1.25em}.sm\:prose img{margin-top:2em;margin-bottom:2em}.sm\:prose video{margin-top:2em;margin-bottom:2em}.sm\:prose figure{margin-top:2em;margin-bottom:2em}.sm\:prose figure>*{margin-top:0;margin-bottom:0}.sm\:prose h2 code{font-size:.875em}.sm\:prose h3 code{font-size:.9em}.sm\:prose ul{margin-top:1.25em;margin-bottom:1.25em}.sm\:prose li{margin-top:.5em;margin-bottom:.5em}.sm\:prose ol>li:before{left:0}.sm\:prose>ul>li p{margin-top:.75em;margin-bottom:.75em}.sm\:prose>ul>li>:first-child{margin-top:1.25em}.sm\:prose>ul>li>:last-child{margin-bottom:1.25em}.sm\:prose>ol>li>:first-child{margin-top:1.25em}.sm\:prose>ol>li>:last-child{margin-bottom:1.25em}.sm\:prose ol ol,.sm\:prose ol ul,.sm\:prose ul ol,.sm\:prose ul ul{margin-top:.75em;margin-bottom:.75em}.sm\:prose hr+*{margin-top:0}.sm\:prose h2+*{margin-top:0}.sm\:prose h3+*{margin-top:0}.sm\:prose h4+*{margin-top:0}.sm\:prose thead th:first-child{padding-left:0}.sm\:prose thead th:last-child{padding-right:0}.sm\:prose tbody td:first-child{padding-left:0}.sm\:prose tbody td:last-child{padding-right:0}.sm\:prose>:first-child{margin-top:0}.sm\:prose>:last-child{margin-bottom:0}.sm\:prose h1,.sm\:prose h2,.sm\:prose h3,.sm\:prose h4{color:#161e2e}.sm\:prose-sm{font-size:.875rem;line-height:1.7142857}.sm\:prose-sm p{margin-top:1.1428571em;margin-bottom:1.1428571em}.sm\:prose-sm [class~=lead]{font-size:1.2857143em;line-height:1.5555556;margin-top:.8888889em;margin-bottom:.8888889em}.sm\:prose-sm blockquote{margin-top:1.3333333em;margin-bottom:1.3333333em;padding-left:1.1111111em}.sm\:prose-sm h1{font-size:2.1428571em;margin-top:0;margin-bottom:.8em;line-height:1.2}.sm\:prose-sm h2{font-size:1.4285714em;margin-top:1.6em;margin-bottom:.8em;line-height:1.4}.sm\:prose-sm h3{font-size:1.2857143em;margin-top:1.5555556em;margin-bottom:.4444444em;line-height:1.5555556}.sm\:prose-sm h4{margin-top:1.4285714em;margin-bottom:.5714286em;line-height:1.4285714}.sm\:prose-sm img{margin-top:1.7142857em;margin-bottom:1.7142857em}.sm\:prose-sm video{margin-top:1.7142857em;margin-bottom:1.7142857em}.sm\:prose-sm figure{margin-top:1.7142857em;margin-bottom:1.7142857em}.sm\:prose-sm figure>*{margin-top:0;margin-bottom:0}.sm\:prose-sm figure figcaption{font-size:.8571429em;line-height:1.3333333;margin-top:.6666667em}.sm\:prose-sm code{font-size:.8571429em}.sm\:prose-sm h2 code{font-size:.9em}.sm\:prose-sm h3 code{font-size:.8888889em}.sm\:prose-sm pre{font-size:.8571429em;line-height:1.6666667;margin-top:1.6666667em;margin-bottom:1.6666667em;border-radius:.25rem;padding-top:.6666667em;padding-right:1em;padding-bottom:.6666667em;padding-left:1em}.sm\:prose-sm ol{margin-top:1.1428571em;margin-bottom:1.1428571em}.sm\:prose-sm ul{margin-top:1.1428571em;margin-bottom:1.1428571em}.sm\:prose-sm li{margin-top:.2857143em;margin-bottom:.2857143em}.sm\:prose-sm ol>li{padding-left:1.5714286em}.sm\:prose-sm ol>li:before{left:0}.sm\:prose-sm ul>li{padding-left:1.5714286em}.sm\:prose-sm ul>li::before{height:.3571429em;width:.3571429em;top:calc(.8571429em - .1785714em);left:.2142857em}.sm\:prose-sm>ul>li p{margin-top:.5714286em;margin-bottom:.5714286em}.sm\:prose-sm>ul>li>:first-child{margin-top:1.1428571em}.sm\:prose-sm>ul>li>:last-child{margin-bottom:1.1428571em}.sm\:prose-sm>ol>li>:first-child{margin-top:1.1428571em}.sm\:prose-sm>ol>li>:last-child{margin-bottom:1.1428571em}.sm\:prose-sm ol ol,.sm\:prose-sm ol ul,.sm\:prose-sm ul ol,.sm\:prose-sm ul ul{margin-top:.5714286em;margin-bottom:.5714286em}.sm\:prose-sm hr{margin-top:2.8571429em;margin-bottom:2.8571429em}.sm\:prose-sm hr+*{margin-top:0}.sm\:prose-sm h2+*{margin-top:0}.sm\:prose-sm h3+*{margin-top:0}.sm\:prose-sm h4+*{margin-top:0}.sm\:prose-sm table{font-size:.8571429em;line-height:1.5}.sm\:prose-sm thead th{padding-right:1em;padding-bottom:.6666667em;padding-left:1em}.sm\:prose-sm thead th:first-child{padding-left:0}.sm\:prose-sm thead th:last-child{padding-right:0}.sm\:prose-sm tbody td{padding-top:.6666667em;padding-right:1em;padding-bottom:.6666667em;padding-left:1em}.sm\:prose-sm tbody td:first-child{padding-left:0}.sm\:prose-sm tbody td:last-child{padding-right:0}.sm\:prose-sm>:first-child{margin-top:0}.sm\:prose-sm>:last-child{margin-bottom:0}.sm\:prose-lg{font-size:1.125rem;line-height:1.7777778}.sm\:prose-lg p{margin-top:1.3333333em;margin-bottom:1.3333333em}.sm\:prose-lg [class~=lead]{font-size:1.2222222em;line-height:1.4545455;margin-top:1.0909091em;margin-bottom:1.0909091em}.sm\:prose-lg blockquote{margin-top:1.6666667em;margin-bottom:1.6666667em;padding-left:1em}.sm\:prose-lg h1{font-size:2.6666667em;margin-top:0;margin-bottom:.8333333em;line-height:1}.sm\:prose-lg h2{font-size:1.6666667em;margin-top:1.8666667em;margin-bottom:1.0666667em;line-height:1.3333333}.sm\:prose-lg h3{font-size:1.3333333em;margin-top:1.6666667em;margin-bottom:.6666667em;line-height:1.5}.sm\:prose-lg h4{margin-top:1.7777778em;margin-bottom:.4444444em;line-height:1.5555556}.sm\:prose-lg img{margin-top:1.7777778em;margin-bottom:1.7777778em}.sm\:prose-lg video{margin-top:1.7777778em;margin-bottom:1.7777778em}.sm\:prose-lg figure{margin-top:1.7777778em;margin-bottom:1.7777778em}.sm\:prose-lg figure>*{margin-top:0;margin-bottom:0}.sm\:prose-lg figure figcaption{font-size:.8888889em;line-height:1.5;margin-top:1em}.sm\:prose-lg code{font-size:.8888889em}.sm\:prose-lg h2 code{font-size:.8666667em}.sm\:prose-lg h3 code{font-size:.875em}.sm\:prose-lg pre{font-size:.8888889em;line-height:1.75;margin-top:2em;margin-bottom:2em;border-radius:.375rem;padding-top:1em;padding-right:1.5em;padding-bottom:1em;padding-left:1.5em}.sm\:prose-lg ol{margin-top:1.3333333em;margin-bottom:1.3333333em}.sm\:prose-lg ul{margin-top:1.3333333em;margin-bottom:1.3333333em}.sm\:prose-lg li{margin-top:.6666667em;margin-bottom:.6666667em}.sm\:prose-lg ol>li{padding-left:1.6666667em}.sm\:prose-lg ol>li:before{left:0}.sm\:prose-lg ul>li{padding-left:1.6666667em}.sm\:prose-lg ul>li::before{width:.3333333em;height:.3333333em;top:calc(.8888889em - .1666667em);left:.2222222em}.sm\:prose-lg>ul>li p{margin-top:.8888889em;margin-bottom:.8888889em}.sm\:prose-lg>ul>li>:first-child{margin-top:1.3333333em}.sm\:prose-lg>ul>li>:last-child{margin-bottom:1.3333333em}.sm\:prose-lg>ol>li>:first-child{margin-top:1.3333333em}.sm\:prose-lg>ol>li>:last-child{margin-bottom:1.3333333em}.sm\:prose-lg ol ol,.sm\:prose-lg ol ul,.sm\:prose-lg ul ol,.sm\:prose-lg ul ul{margin-top:.8888889em;margin-bottom:.8888889em}.sm\:prose-lg hr{margin-top:3.1111111em;margin-bottom:3.1111111em}.sm\:prose-lg hr+*{margin-top:0}.sm\:prose-lg h2+*{margin-top:0}.sm\:prose-lg h3+*{margin-top:0}.sm\:prose-lg h4+*{margin-top:0}.sm\:prose-lg table{font-size:.8888889em;line-height:1.5}.sm\:prose-lg thead th{padding-right:.75em;padding-bottom:.75em;padding-left:.75em}.sm\:prose-lg thead th:first-child{padding-left:0}.sm\:prose-lg thead th:last-child{padding-right:0}.sm\:prose-lg tbody td{padding-top:.75em;padding-right:.75em;padding-bottom:.75em;padding-left:.75em}.sm\:prose-lg tbody td:first-child{padding-left:0}.sm\:prose-lg tbody td:last-child{padding-right:0}.sm\:prose-lg>:first-child{margin-top:0}.sm\:prose-lg>:last-child{margin-bottom:0}.sm\:prose-xl{font-size:1.25rem;line-height:1.8}.sm\:prose-xl p{margin-top:1.2em;margin-bottom:1.2em}.sm\:prose-xl [class~=lead]{font-size:1.2em;line-height:1.5;margin-top:1em;margin-bottom:1em}.sm\:prose-xl blockquote{margin-top:1.6em;margin-bottom:1.6em;padding-left:1.0666667em}.sm\:prose-xl h1{font-size:2.8em;margin-top:0;margin-bottom:.8571429em;line-height:1}.sm\:prose-xl h2{font-size:1.8em;margin-top:1.5555556em;margin-bottom:.8888889em;line-height:1.1111111}.sm\:prose-xl h3{font-size:1.5em;margin-top:1.6em;margin-bottom:.6666667em;line-height:1.3333333}.sm\:prose-xl h4{margin-top:1.8em;margin-bottom:.6em;line-height:1.6}.sm\:prose-xl img{margin-top:2em;margin-bottom:2em}.sm\:prose-xl video{margin-top:2em;margin-bottom:2em}.sm\:prose-xl figure{margin-top:2em;margin-bottom:2em}.sm\:prose-xl figure>*{margin-top:0;margin-bottom:0}.sm\:prose-xl figure figcaption{font-size:.9em;line-height:1.5555556;margin-top:1em}.sm\:prose-xl code{font-size:.9em}.sm\:prose-xl h2 code{font-size:.8611111em}.sm\:prose-xl h3 code{font-size:.9em}.sm\:prose-xl pre{font-size:.9em;line-height:1.7777778;margin-top:2em;margin-bottom:2em;border-radius:.5rem;padding-top:1.1111111em;padding-right:1.3333333em;padding-bottom:1.1111111em;padding-left:1.3333333em}.sm\:prose-xl ol{margin-top:1.2em;margin-bottom:1.2em}.sm\:prose-xl ul{margin-top:1.2em;margin-bottom:1.2em}.sm\:prose-xl li{margin-top:.6em;margin-bottom:.6em}.sm\:prose-xl ol>li{padding-left:1.8em}.sm\:prose-xl ol>li:before{left:0}.sm\:prose-xl ul>li{padding-left:1.8em}.sm\:prose-xl ul>li::before{width:.35em;height:.35em;top:calc(.9em - .175em);left:.25em}.sm\:prose-xl>ul>li p{margin-top:.8em;margin-bottom:.8em}.sm\:prose-xl>ul>li>:first-child{margin-top:1.2em}.sm\:prose-xl>ul>li>:last-child{margin-bottom:1.2em}.sm\:prose-xl>ol>li>:first-child{margin-top:1.2em}.sm\:prose-xl>ol>li>:last-child{margin-bottom:1.2em}.sm\:prose-xl ol ol,.sm\:prose-xl ol ul,.sm\:prose-xl ul ol,.sm\:prose-xl ul ul{margin-top:.8em;margin-bottom:.8em}.sm\:prose-xl hr{margin-top:2.8em;margin-bottom:2.8em}.sm\:prose-xl hr+*{margin-top:0}.sm\:prose-xl h2+*{margin-top:0}.sm\:prose-xl h3+*{margin-top:0}.sm\:prose-xl h4+*{margin-top:0}.sm\:prose-xl table{font-size:.9em;line-height:1.5555556}.sm\:prose-xl thead th{padding-right:.6666667em;padding-bottom:.8888889em;padding-left:.6666667em}.sm\:prose-xl thead th:first-child{padding-left:0}.sm\:prose-xl thead th:last-child{padding-right:0}.sm\:prose-xl tbody td{padding-top:.8888889em;padding-right:.6666667em;padding-bottom:.8888889em;padding-left:.6666667em}.sm\:prose-xl tbody td:first-child{padding-left:0}.sm\:prose-xl tbody td:last-child{padding-right:0}.sm\:prose-xl>:first-child{margin-top:0}.sm\:prose-xl>:last-child{margin-bottom:0}.sm\:prose-2xl{font-size:1.5rem;line-height:1.6666667}.sm\:prose-2xl p{margin-top:1.3333333em;margin-bottom:1.3333333em}.sm\:prose-2xl [class~=lead]{font-size:1.25em;line-height:1.4666667;margin-top:1.0666667em;margin-bottom:1.0666667em}.sm\:prose-2xl blockquote{margin-top:1.7777778em;margin-bottom:1.7777778em;padding-left:1.1111111em}.sm\:prose-2xl h1{font-size:2.6666667em;margin-top:0;margin-bottom:.875em;line-height:1}.sm\:prose-2xl h2{font-size:2em;margin-top:1.5em;margin-bottom:.8333333em;line-height:1.0833333}.sm\:prose-2xl h3{font-size:1.5em;margin-top:1.5555556em;margin-bottom:.6666667em;line-height:1.2222222}.sm\:prose-2xl h4{margin-top:1.6666667em;margin-bottom:.6666667em;line-height:1.5}.sm\:prose-2xl img{margin-top:2em;margin-bottom:2em}.sm\:prose-2xl video{margin-top:2em;margin-bottom:2em}.sm\:prose-2xl figure{margin-top:2em;margin-bottom:2em}.sm\:prose-2xl figure>*{margin-top:0;margin-bottom:0}.sm\:prose-2xl figure figcaption{font-size:.8333333em;line-height:1.6;margin-top:1em}.sm\:prose-2xl code{font-size:.8333333em}.sm\:prose-2xl h2 code{font-size:.875em}.sm\:prose-2xl h3 code{font-size:.8888889em}.sm\:prose-2xl pre{font-size:.8333333em;line-height:1.8;margin-top:2em;margin-bottom:2em;border-radius:.5rem;padding-top:1.2em;padding-right:1.6em;padding-bottom:1.2em;padding-left:1.6em}.sm\:prose-2xl ol{margin-top:1.3333333em;margin-bottom:1.3333333em}.sm\:prose-2xl ul{margin-top:1.3333333em;margin-bottom:1.3333333em}.sm\:prose-2xl li{margin-top:.5em;margin-bottom:.5em}.sm\:prose-2xl ol>li{padding-left:1.6666667em}.sm\:prose-2xl ol>li:before{left:0}.sm\:prose-2xl ul>li{padding-left:1.6666667em}.sm\:prose-2xl ul>li::before{width:.3333333em;height:.3333333em;top:calc(.8333333em - .1666667em);left:.25em}.sm\:prose-2xl>ul>li p{margin-top:.8333333em;margin-bottom:.8333333em}.sm\:prose-2xl>ul>li>:first-child{margin-top:1.3333333em}.sm\:prose-2xl>ul>li>:last-child{margin-bottom:1.3333333em}.sm\:prose-2xl>ol>li>:first-child{margin-top:1.3333333em}.sm\:prose-2xl>ol>li>:last-child{margin-bottom:1.3333333em}.sm\:prose-2xl ol ol,.sm\:prose-2xl ol ul,.sm\:prose-2xl ul ol,.sm\:prose-2xl ul ul{margin-top:.6666667em;margin-bottom:.6666667em}.sm\:prose-2xl hr{margin-top:3em;margin-bottom:3em}.sm\:prose-2xl hr+*{margin-top:0}.sm\:prose-2xl h2+*{margin-top:0}.sm\:prose-2xl h3+*{margin-top:0}.sm\:prose-2xl h4+*{margin-top:0}.sm\:prose-2xl table{font-size:.8333333em;line-height:1.4}.sm\:prose-2xl thead th{padding-right:.6em;padding-bottom:.8em;padding-left:.6em}.sm\:prose-2xl thead th:first-child{padding-left:0}.sm\:prose-2xl thead th:last-child{padding-right:0}.sm\:prose-2xl tbody td{padding-top:.8em;padding-right:.6em;padding-bottom:.8em;padding-left:.6em}.sm\:prose-2xl tbody td:first-child{padding-left:0}.sm\:prose-2xl tbody td:last-child{padding-right:0}.sm\:prose-2xl>:first-child{margin-top:0}.sm\:prose-2xl>:last-child{margin-bottom:0}.sm\:space-y-0>:not(template)~:not(template){--space-y-reverse:0;margin-top:calc(0px * calc(1 - var(--space-y-reverse)));margin-bottom:calc(0px * var(--space-y-reverse))}.sm\:space-y-12>:not(template)~:not(template){--space-y-reverse:0;margin-top:calc(3rem * calc(1 - var(--space-y-reverse)));margin-bottom:calc(3rem * var(--space-y-reverse))}.sm\:block{display:block}.sm\:inline-block{display:inline-block}.sm\:flex{display:flex}.sm\:items-center{align-items:center}.sm\:justify-between{justify-content:space-between}.sm\:flex-1{flex:1 1 0%}.sm\:h-8{height:2rem}.sm\:h-10{height:2.5rem}.sm\:text-lg{font-size:1.125rem}.sm\:text-2xl{font-size:1.5rem}.sm\:text-3xl{font-size:1.875rem}.sm\:text-4xl{font-size:2.25rem}.sm\:leading-9{line-height:2.25rem}.sm\:leading-10{line-height:2.5rem}.sm\:-mx-6{margin-left:-1.5rem;margin-right:-1.5rem}.sm\:ml-1{margin-left:.25rem}.sm\:mt-2{margin-top:.5rem}.sm\:ml-8{margin-left:2rem}.sm\:mt-12{margin-top:3rem}.sm\:mt-16{margin-top:4rem}.sm\:p-6{padding:1.5rem}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}.sm\:py-12{padding-top:3rem;padding-bottom:3rem}.sm\:pt-16{padding-top:4rem}.sm\:w-0{width:0}.sm\:w-8{width:2rem}}@media (min-width:768px){.md\:container{width:100%}@media (min-width:640px){.md\:container{max-width:640px}}@media (min-width:768px){.md\:container{max-width:768px}}@media (min-width:1024px){.md\:container{max-width:1024px}}@media (min-width:1280px){.md\:container{max-width:1280px}}.md\:prose{color:#374151;max-width:65ch}.md\:prose [class~=lead]{color:#4b5563;font-size:1.25em;line-height:1.6;margin-top:1.2em;margin-bottom:1.2em}.md\:prose a{color:#5850ec;text-decoration:none;font-weight:600}.md\:prose strong{color:#161e2e;font-weight:600}.md\:prose ol{counter-reset:list-counter;margin-top:1.25em;margin-bottom:1.25em}.md\:prose ol>li{position:relative;counter-increment:list-counter;padding-left:1.75em}.md\:prose ol>li::before{content:counter(list-counter) ".";position:absolute;font-weight:400;color:#6b7280}.md\:prose ul>li{position:relative;padding-left:1.75em}.md\:prose ul>li::before{content:"";position:absolute;background-color:#d2d6dc;border-radius:50%;width:.375em;height:.375em;top:calc(.875em - .1875em);left:.25em}.md\:prose hr{border-color:#e5e7eb;border-top-width:1px;margin-top:3em;margin-bottom:3em}.md\:prose blockquote{font-weight:500;font-style:italic;color:#161e2e;border-left-width:.25rem;border-left-color:#e5e7eb;quotes:"\201C""\201D""\2018""\2019";margin-top:1.6em;margin-bottom:1.6em;padding-left:1em}.md\:prose blockquote p:first-of-type::before{content:open-quote}.md\:prose blockquote p:last-of-type::after{content:close-quote}.md\:prose h1{color:#1a202c;font-weight:800;font-size:2.25em;margin-top:0;margin-bottom:.8888889em;line-height:1.1111111}.md\:prose h2{color:#1a202c;font-weight:700;font-size:1.5em;margin-top:2em;margin-bottom:1em;line-height:1.3333333}.md\:prose h3{color:#1a202c;font-weight:600;font-size:1.25em;margin-top:1.6em;margin-bottom:.6em;line-height:1.6}.md\:prose h4{color:#1a202c;font-weight:600;margin-top:1.5em;margin-bottom:.5em;line-height:1.5}.md\:prose figure figcaption{color:#6b7280;font-size:.875em;line-height:1.4285714;margin-top:.8571429em}.md\:prose code{color:#161e2e;font-weight:600;font-size:.875em}.md\:prose code::before{content:"`"}.md\:prose code::after{content:"`"}.md\:prose pre{color:#e5e7eb;background-color:#252f3f;overflow-x:auto;font-size:.875em;line-height:1.7142857;margin-top:1.7142857em;margin-bottom:1.7142857em;border-radius:.375rem;padding-top:.8571429em;padding-right:1.1428571em;padding-bottom:.8571429em;padding-left:1.1428571em}.md\:prose pre code{background-color:transparent;border-width:0;border-radius:0;padding:0;font-weight:400;color:inherit;font-size:inherit;font-family:inherit;line-height:inherit}.md\:prose pre code::before{content:""}.md\:prose pre code::after{content:""}.md\:prose table{width:100%;table-layout:auto;text-align:left;margin-top:2em;margin-bottom:2em;font-size:.875em;line-height:1.7142857}.md\:prose thead{color:#161e2e;font-weight:600;border-bottom-width:1px;border-bottom-color:#d2d6dc}.md\:prose thead th{vertical-align:bottom;padding-right:.5714286em;padding-bottom:.5714286em;padding-left:.5714286em}.md\:prose tbody tr{border-bottom-width:1px;border-bottom-color:#e5e7eb}.md\:prose tbody tr:last-child{border-bottom-width:0}.md\:prose tbody td{vertical-align:top;padding-top:.5714286em;padding-right:.5714286em;padding-bottom:.5714286em;padding-left:.5714286em}.md\:prose{font-size:1rem;line-height:1.75}.md\:prose p{margin-top:1.25em;margin-bottom:1.25em}.md\:prose img{margin-top:2em;margin-bottom:2em}.md\:prose video{margin-top:2em;margin-bottom:2em}.md\:prose figure{margin-top:2em;margin-bottom:2em}.md\:prose figure>*{margin-top:0;margin-bottom:0}.md\:prose h2 code{font-size:.875em}.md\:prose h3 code{font-size:.9em}.md\:prose ul{margin-top:1.25em;margin-bottom:1.25em}.md\:prose li{margin-top:.5em;margin-bottom:.5em}.md\:prose ol>li:before{left:0}.md\:prose>ul>li p{margin-top:.75em;margin-bottom:.75em}.md\:prose>ul>li>:first-child{margin-top:1.25em}.md\:prose>ul>li>:last-child{margin-bottom:1.25em}.md\:prose>ol>li>:first-child{margin-top:1.25em}.md\:prose>ol>li>:last-child{margin-bottom:1.25em}.md\:prose ol ol,.md\:prose ol ul,.md\:prose ul ol,.md\:prose ul ul{margin-top:.75em;margin-bottom:.75em}.md\:prose hr+*{margin-top:0}.md\:prose h2+*{margin-top:0}.md\:prose h3+*{margin-top:0}.md\:prose h4+*{margin-top:0}.md\:prose thead th:first-child{padding-left:0}.md\:prose thead th:last-child{padding-right:0}.md\:prose tbody td:first-child{padding-left:0}.md\:prose tbody td:last-child{padding-right:0}.md\:prose>:first-child{margin-top:0}.md\:prose>:last-child{margin-bottom:0}.md\:prose h1,.md\:prose h2,.md\:prose h3,.md\:prose h4{color:#161e2e}.md\:prose-sm{font-size:.875rem;line-height:1.7142857}.md\:prose-sm p{margin-top:1.1428571em;margin-bottom:1.1428571em}.md\:prose-sm [class~=lead]{font-size:1.2857143em;line-height:1.5555556;margin-top:.8888889em;margin-bottom:.8888889em}.md\:prose-sm blockquote{margin-top:1.3333333em;margin-bottom:1.3333333em;padding-left:1.1111111em}.md\:prose-sm h1{font-size:2.1428571em;margin-top:0;margin-bottom:.8em;line-height:1.2}.md\:prose-sm h2{font-size:1.4285714em;margin-top:1.6em;margin-bottom:.8em;line-height:1.4}.md\:prose-sm h3{font-size:1.2857143em;margin-top:1.5555556em;margin-bottom:.4444444em;line-height:1.5555556}.md\:prose-sm h4{margin-top:1.4285714em;margin-bottom:.5714286em;line-height:1.4285714}.md\:prose-sm img{margin-top:1.7142857em;margin-bottom:1.7142857em}.md\:prose-sm video{margin-top:1.7142857em;margin-bottom:1.7142857em}.md\:prose-sm figure{margin-top:1.7142857em;margin-bottom:1.7142857em}.md\:prose-sm figure>*{margin-top:0;margin-bottom:0}.md\:prose-sm figure figcaption{font-size:.8571429em;line-height:1.3333333;margin-top:.6666667em}.md\:prose-sm code{font-size:.8571429em}.md\:prose-sm h2 code{font-size:.9em}.md\:prose-sm h3 code{font-size:.8888889em}.md\:prose-sm pre{font-size:.8571429em;line-height:1.6666667;margin-top:1.6666667em;margin-bottom:1.6666667em;border-radius:.25rem;padding-top:.6666667em;padding-right:1em;padding-bottom:.6666667em;padding-left:1em}.md\:prose-sm ol{margin-top:1.1428571em;margin-bottom:1.1428571em}.md\:prose-sm ul{margin-top:1.1428571em;margin-bottom:1.1428571em}.md\:prose-sm li{margin-top:.2857143em;margin-bottom:.2857143em}.md\:prose-sm ol>li{padding-left:1.5714286em}.md\:prose-sm ol>li:before{left:0}.md\:prose-sm ul>li{padding-left:1.5714286em}.md\:prose-sm ul>li::before{height:.3571429em;width:.3571429em;top:calc(.8571429em - .1785714em);left:.2142857em}.md\:prose-sm>ul>li p{margin-top:.5714286em;margin-bottom:.5714286em}.md\:prose-sm>ul>li>:first-child{margin-top:1.1428571em}.md\:prose-sm>ul>li>:last-child{margin-bottom:1.1428571em}.md\:prose-sm>ol>li>:first-child{margin-top:1.1428571em}.md\:prose-sm>ol>li>:last-child{margin-bottom:1.1428571em}.md\:prose-sm ol ol,.md\:prose-sm ol ul,.md\:prose-sm ul ol,.md\:prose-sm ul ul{margin-top:.5714286em;margin-bottom:.5714286em}.md\:prose-sm hr{margin-top:2.8571429em;margin-bottom:2.8571429em}.md\:prose-sm hr+*{margin-top:0}.md\:prose-sm h2+*{margin-top:0}.md\:prose-sm h3+*{margin-top:0}.md\:prose-sm h4+*{margin-top:0}.md\:prose-sm table{font-size:.8571429em;line-height:1.5}.md\:prose-sm thead th{padding-right:1em;padding-bottom:.6666667em;padding-left:1em}.md\:prose-sm thead th:first-child{padding-left:0}.md\:prose-sm thead th:last-child{padding-right:0}.md\:prose-sm tbody td{padding-top:.6666667em;padding-right:1em;padding-bottom:.6666667em;padding-left:1em}.md\:prose-sm tbody td:first-child{padding-left:0}.md\:prose-sm tbody td:last-child{padding-right:0}.md\:prose-sm>:first-child{margin-top:0}.md\:prose-sm>:last-child{margin-bottom:0}.md\:prose-lg{font-size:1.125rem;line-height:1.7777778}.md\:prose-lg p{margin-top:1.3333333em;margin-bottom:1.3333333em}.md\:prose-lg [class~=lead]{font-size:1.2222222em;line-height:1.4545455;margin-top:1.0909091em;margin-bottom:1.0909091em}.md\:prose-lg blockquote{margin-top:1.6666667em;margin-bottom:1.6666667em;padding-left:1em}.md\:prose-lg h1{font-size:2.6666667em;margin-top:0;margin-bottom:.8333333em;line-height:1}.md\:prose-lg h2{font-size:1.6666667em;margin-top:1.8666667em;margin-bottom:1.0666667em;line-height:1.3333333}.md\:prose-lg h3{font-size:1.3333333em;margin-top:1.6666667em;margin-bottom:.6666667em;line-height:1.5}.md\:prose-lg h4{margin-top:1.7777778em;margin-bottom:.4444444em;line-height:1.5555556}.md\:prose-lg img{margin-top:1.7777778em;margin-bottom:1.7777778em}.md\:prose-lg video{margin-top:1.7777778em;margin-bottom:1.7777778em}.md\:prose-lg figure{margin-top:1.7777778em;margin-bottom:1.7777778em}.md\:prose-lg figure>*{margin-top:0;margin-bottom:0}.md\:prose-lg figure figcaption{font-size:.8888889em;line-height:1.5;margin-top:1em}.md\:prose-lg code{font-size:.8888889em}.md\:prose-lg h2 code{font-size:.8666667em}.md\:prose-lg h3 code{font-size:.875em}.md\:prose-lg pre{font-size:.8888889em;line-height:1.75;margin-top:2em;margin-bottom:2em;border-radius:.375rem;padding-top:1em;padding-right:1.5em;padding-bottom:1em;padding-left:1.5em}.md\:prose-lg ol{margin-top:1.3333333em;margin-bottom:1.3333333em}.md\:prose-lg ul{margin-top:1.3333333em;margin-bottom:1.3333333em}.md\:prose-lg li{margin-top:.6666667em;margin-bottom:.6666667em}.md\:prose-lg ol>li{padding-left:1.6666667em}.md\:prose-lg ol>li:before{left:0}.md\:prose-lg ul>li{padding-left:1.6666667em}.md\:prose-lg ul>li::before{width:.3333333em;height:.3333333em;top:calc(.8888889em - .1666667em);left:.2222222em}.md\:prose-lg>ul>li p{margin-top:.8888889em;margin-bottom:.8888889em}.md\:prose-lg>ul>li>:first-child{margin-top:1.3333333em}.md\:prose-lg>ul>li>:last-child{margin-bottom:1.3333333em}.md\:prose-lg>ol>li>:first-child{margin-top:1.3333333em}.md\:prose-lg>ol>li>:last-child{margin-bottom:1.3333333em}.md\:prose-lg ol ol,.md\:prose-lg ol ul,.md\:prose-lg ul ol,.md\:prose-lg ul ul{margin-top:.8888889em;margin-bottom:.8888889em}.md\:prose-lg hr{margin-top:3.1111111em;margin-bottom:3.1111111em}.md\:prose-lg hr+*{margin-top:0}.md\:prose-lg h2+*{margin-top:0}.md\:prose-lg h3+*{margin-top:0}.md\:prose-lg h4+*{margin-top:0}.md\:prose-lg table{font-size:.8888889em;line-height:1.5}.md\:prose-lg thead th{padding-right:.75em;padding-bottom:.75em;padding-left:.75em}.md\:prose-lg thead th:first-child{padding-left:0}.md\:prose-lg thead th:last-child{padding-right:0}.md\:prose-lg tbody td{padding-top:.75em;padding-right:.75em;padding-bottom:.75em;padding-left:.75em}.md\:prose-lg tbody td:first-child{padding-left:0}.md\:prose-lg tbody td:last-child{padding-right:0}.md\:prose-lg>:first-child{margin-top:0}.md\:prose-lg>:last-child{margin-bottom:0}.md\:prose-xl{font-size:1.25rem;line-height:1.8}.md\:prose-xl p{margin-top:1.2em;margin-bottom:1.2em}.md\:prose-xl [class~=lead]{font-size:1.2em;line-height:1.5;margin-top:1em;margin-bottom:1em}.md\:prose-xl blockquote{margin-top:1.6em;margin-bottom:1.6em;padding-left:1.0666667em}.md\:prose-xl h1{font-size:2.8em;margin-top:0;margin-bottom:.8571429em;line-height:1}.md\:prose-xl h2{font-size:1.8em;margin-top:1.5555556em;margin-bottom:.8888889em;line-height:1.1111111}.md\:prose-xl h3{font-size:1.5em;margin-top:1.6em;margin-bottom:.6666667em;line-height:1.3333333}.md\:prose-xl h4{margin-top:1.8em;margin-bottom:.6em;line-height:1.6}.md\:prose-xl img{margin-top:2em;margin-bottom:2em}.md\:prose-xl video{margin-top:2em;margin-bottom:2em}.md\:prose-xl figure{margin-top:2em;margin-bottom:2em}.md\:prose-xl figure>*{margin-top:0;margin-bottom:0}.md\:prose-xl figure figcaption{font-size:.9em;line-height:1.5555556;margin-top:1em}.md\:prose-xl code{font-size:.9em}.md\:prose-xl h2 code{font-size:.8611111em}.md\:prose-xl h3 code{font-size:.9em}.md\:prose-xl pre{font-size:.9em;line-height:1.7777778;margin-top:2em;margin-bottom:2em;border-radius:.5rem;padding-top:1.1111111em;padding-right:1.3333333em;padding-bottom:1.1111111em;padding-left:1.3333333em}.md\:prose-xl ol{margin-top:1.2em;margin-bottom:1.2em}.md\:prose-xl ul{margin-top:1.2em;margin-bottom:1.2em}.md\:prose-xl li{margin-top:.6em;margin-bottom:.6em}.md\:prose-xl ol>li{padding-left:1.8em}.md\:prose-xl ol>li:before{left:0}.md\:prose-xl ul>li{padding-left:1.8em}.md\:prose-xl ul>li::before{width:.35em;height:.35em;top:calc(.9em - .175em);left:.25em}.md\:prose-xl>ul>li p{margin-top:.8em;margin-bottom:.8em}.md\:prose-xl>ul>li>:first-child{margin-top:1.2em}.md\:prose-xl>ul>li>:last-child{margin-bottom:1.2em}.md\:prose-xl>ol>li>:first-child{margin-top:1.2em}.md\:prose-xl>ol>li>:last-child{margin-bottom:1.2em}.md\:prose-xl ol ol,.md\:prose-xl ol ul,.md\:prose-xl ul ol,.md\:prose-xl ul ul{margin-top:.8em;margin-bottom:.8em}.md\:prose-xl hr{margin-top:2.8em;margin-bottom:2.8em}.md\:prose-xl hr+*{margin-top:0}.md\:prose-xl h2+*{margin-top:0}.md\:prose-xl h3+*{margin-top:0}.md\:prose-xl h4+*{margin-top:0}.md\:prose-xl table{font-size:.9em;line-height:1.5555556}.md\:prose-xl thead th{padding-right:.6666667em;padding-bottom:.8888889em;padding-left:.6666667em}.md\:prose-xl thead th:first-child{padding-left:0}.md\:prose-xl thead th:last-child{padding-right:0}.md\:prose-xl tbody td{padding-top:.8888889em;padding-right:.6666667em;padding-bottom:.8888889em;padding-left:.6666667em}.md\:prose-xl tbody td:first-child{padding-left:0}.md\:prose-xl tbody td:last-child{padding-right:0}.md\:prose-xl>:first-child{margin-top:0}.md\:prose-xl>:last-child{margin-bottom:0}.md\:prose-2xl{font-size:1.5rem;line-height:1.6666667}.md\:prose-2xl p{margin-top:1.3333333em;margin-bottom:1.3333333em}.md\:prose-2xl [class~=lead]{font-size:1.25em;line-height:1.4666667;margin-top:1.0666667em;margin-bottom:1.0666667em}.md\:prose-2xl blockquote{margin-top:1.7777778em;margin-bottom:1.7777778em;padding-left:1.1111111em}.md\:prose-2xl h1{font-size:2.6666667em;margin-top:0;margin-bottom:.875em;line-height:1}.md\:prose-2xl h2{font-size:2em;margin-top:1.5em;margin-bottom:.8333333em;line-height:1.0833333}.md\:prose-2xl h3{font-size:1.5em;margin-top:1.5555556em;margin-bottom:.6666667em;line-height:1.2222222}.md\:prose-2xl h4{margin-top:1.6666667em;margin-bottom:.6666667em;line-height:1.5}.md\:prose-2xl img{margin-top:2em;margin-bottom:2em}.md\:prose-2xl video{margin-top:2em;margin-bottom:2em}.md\:prose-2xl figure{margin-top:2em;margin-bottom:2em}.md\:prose-2xl figure>*{margin-top:0;margin-bottom:0}.md\:prose-2xl figure figcaption{font-size:.8333333em;line-height:1.6;margin-top:1em}.md\:prose-2xl code{font-size:.8333333em}.md\:prose-2xl h2 code{font-size:.875em}.md\:prose-2xl h3 code{font-size:.8888889em}.md\:prose-2xl pre{font-size:.8333333em;line-height:1.8;margin-top:2em;margin-bottom:2em;border-radius:.5rem;padding-top:1.2em;padding-right:1.6em;padding-bottom:1.2em;padding-left:1.6em}.md\:prose-2xl ol{margin-top:1.3333333em;margin-bottom:1.3333333em}.md\:prose-2xl ul{margin-top:1.3333333em;margin-bottom:1.3333333em}.md\:prose-2xl li{margin-top:.5em;margin-bottom:.5em}.md\:prose-2xl ol>li{padding-left:1.6666667em}.md\:prose-2xl ol>li:before{left:0}.md\:prose-2xl ul>li{padding-left:1.6666667em}.md\:prose-2xl ul>li::before{width:.3333333em;height:.3333333em;top:calc(.8333333em - .1666667em);left:.25em}.md\:prose-2xl>ul>li p{margin-top:.8333333em;margin-bottom:.8333333em}.md\:prose-2xl>ul>li>:first-child{margin-top:1.3333333em}.md\:prose-2xl>ul>li>:last-child{margin-bottom:1.3333333em}.md\:prose-2xl>ol>li>:first-child{margin-top:1.3333333em}.md\:prose-2xl>ol>li>:last-child{margin-bottom:1.3333333em}.md\:prose-2xl ol ol,.md\:prose-2xl ol ul,.md\:prose-2xl ul ol,.md\:prose-2xl ul ul{margin-top:.6666667em;margin-bottom:.6666667em}.md\:prose-2xl hr{margin-top:3em;margin-bottom:3em}.md\:prose-2xl hr+*{margin-top:0}.md\:prose-2xl h2+*{margin-top:0}.md\:prose-2xl h3+*{margin-top:0}.md\:prose-2xl h4+*{margin-top:0}.md\:prose-2xl table{font-size:.8333333em;line-height:1.4}.md\:prose-2xl thead th{padding-right:.6em;padding-bottom:.8em;padding-left:.6em}.md\:prose-2xl thead th:first-child{padding-left:0}.md\:prose-2xl thead th:last-child{padding-right:0}.md\:prose-2xl tbody td{padding-top:.8em;padding-right:.6em;padding-bottom:.8em;padding-left:.6em}.md\:prose-2xl tbody td:first-child{padding-left:0}.md\:prose-2xl tbody td:last-child{padding-right:0}.md\:prose-2xl>:first-child{margin-top:0}.md\:prose-2xl>:last-child{margin-bottom:0}.md\:justify-center{justify-content:center}.md\:text-6xl{font-size:4rem}.md\:leading-relaxed{line-height:1.625}.md\:mt-16{margin-top:4rem}}@media (min-width:1024px){.lg\:container{width:100%}@media (min-width:640px){.lg\:container{max-width:640px}}@media (min-width:768px){.lg\:container{max-width:768px}}@media (min-width:1024px){.lg\:container{max-width:1024px}}@media (min-width:1280px){.lg\:container{max-width:1280px}}.lg\:prose{color:#374151;max-width:65ch}.lg\:prose [class~=lead]{color:#4b5563;font-size:1.25em;line-height:1.6;margin-top:1.2em;margin-bottom:1.2em}.lg\:prose a{color:#5850ec;text-decoration:none;font-weight:600}.lg\:prose strong{color:#161e2e;font-weight:600}.lg\:prose ol{counter-reset:list-counter;margin-top:1.25em;margin-bottom:1.25em}.lg\:prose ol>li{position:relative;counter-increment:list-counter;padding-left:1.75em}.lg\:prose ol>li::before{content:counter(list-counter) ".";position:absolute;font-weight:400;color:#6b7280}.lg\:prose ul>li{position:relative;padding-left:1.75em}.lg\:prose ul>li::before{content:"";position:absolute;background-color:#d2d6dc;border-radius:50%;width:.375em;height:.375em;top:calc(.875em - .1875em);left:.25em}.lg\:prose hr{border-color:#e5e7eb;border-top-width:1px;margin-top:3em;margin-bottom:3em}.lg\:prose blockquote{font-weight:500;font-style:italic;color:#161e2e;border-left-width:.25rem;border-left-color:#e5e7eb;quotes:"\201C""\201D""\2018""\2019";margin-top:1.6em;margin-bottom:1.6em;padding-left:1em}.lg\:prose blockquote p:first-of-type::before{content:open-quote}.lg\:prose blockquote p:last-of-type::after{content:close-quote}.lg\:prose h1{color:#1a202c;font-weight:800;font-size:2.25em;margin-top:0;margin-bottom:.8888889em;line-height:1.1111111}.lg\:prose h2{color:#1a202c;font-weight:700;font-size:1.5em;margin-top:2em;margin-bottom:1em;line-height:1.3333333}.lg\:prose h3{color:#1a202c;font-weight:600;font-size:1.25em;margin-top:1.6em;margin-bottom:.6em;line-height:1.6}.lg\:prose h4{color:#1a202c;font-weight:600;margin-top:1.5em;margin-bottom:.5em;line-height:1.5}.lg\:prose figure figcaption{color:#6b7280;font-size:.875em;line-height:1.4285714;margin-top:.8571429em}.lg\:prose code{color:#161e2e;font-weight:600;font-size:.875em}.lg\:prose code::before{content:"`"}.lg\:prose code::after{content:"`"}.lg\:prose pre{color:#e5e7eb;background-color:#252f3f;overflow-x:auto;font-size:.875em;line-height:1.7142857;margin-top:1.7142857em;margin-bottom:1.7142857em;border-radius:.375rem;padding-top:.8571429em;padding-right:1.1428571em;padding-bottom:.8571429em;padding-left:1.1428571em}.lg\:prose pre code{background-color:transparent;border-width:0;border-radius:0;padding:0;font-weight:400;color:inherit;font-size:inherit;font-family:inherit;line-height:inherit}.lg\:prose pre code::before{content:""}.lg\:prose pre code::after{content:""}.lg\:prose table{width:100%;table-layout:auto;text-align:left;margin-top:2em;margin-bottom:2em;font-size:.875em;line-height:1.7142857}.lg\:prose thead{color:#161e2e;font-weight:600;border-bottom-width:1px;border-bottom-color:#d2d6dc}.lg\:prose thead th{vertical-align:bottom;padding-right:.5714286em;padding-bottom:.5714286em;padding-left:.5714286em}.lg\:prose tbody tr{border-bottom-width:1px;border-bottom-color:#e5e7eb}.lg\:prose tbody tr:last-child{border-bottom-width:0}.lg\:prose tbody td{vertical-align:top;padding-top:.5714286em;padding-right:.5714286em;padding-bottom:.5714286em;padding-left:.5714286em}.lg\:prose{font-size:1rem;line-height:1.75}.lg\:prose p{margin-top:1.25em;margin-bottom:1.25em}.lg\:prose img{margin-top:2em;margin-bottom:2em}.lg\:prose video{margin-top:2em;margin-bottom:2em}.lg\:prose figure{margin-top:2em;margin-bottom:2em}.lg\:prose figure>*{margin-top:0;margin-bottom:0}.lg\:prose h2 code{font-size:.875em}.lg\:prose h3 code{font-size:.9em}.lg\:prose ul{margin-top:1.25em;margin-bottom:1.25em}.lg\:prose li{margin-top:.5em;margin-bottom:.5em}.lg\:prose ol>li:before{left:0}.lg\:prose>ul>li p{margin-top:.75em;margin-bottom:.75em}.lg\:prose>ul>li>:first-child{margin-top:1.25em}.lg\:prose>ul>li>:last-child{margin-bottom:1.25em}.lg\:prose>ol>li>:first-child{margin-top:1.25em}.lg\:prose>ol>li>:last-child{margin-bottom:1.25em}.lg\:prose ol ol,.lg\:prose ol ul,.lg\:prose ul ol,.lg\:prose ul ul{margin-top:.75em;margin-bottom:.75em}.lg\:prose hr+*{margin-top:0}.lg\:prose h2+*{margin-top:0}.lg\:prose h3+*{margin-top:0}.lg\:prose h4+*{margin-top:0}.lg\:prose thead th:first-child{padding-left:0}.lg\:prose thead th:last-child{padding-right:0}.lg\:prose tbody td:first-child{padding-left:0}.lg\:prose tbody td:last-child{padding-right:0}.lg\:prose>:first-child{margin-top:0}.lg\:prose>:last-child{margin-bottom:0}.lg\:prose h1,.lg\:prose h2,.lg\:prose h3,.lg\:prose h4{color:#161e2e}.lg\:prose-sm{font-size:.875rem;line-height:1.7142857}.lg\:prose-sm p{margin-top:1.1428571em;margin-bottom:1.1428571em}.lg\:prose-sm [class~=lead]{font-size:1.2857143em;line-height:1.5555556;margin-top:.8888889em;margin-bottom:.8888889em}.lg\:prose-sm blockquote{margin-top:1.3333333em;margin-bottom:1.3333333em;padding-left:1.1111111em}.lg\:prose-sm h1{font-size:2.1428571em;margin-top:0;margin-bottom:.8em;line-height:1.2}.lg\:prose-sm h2{font-size:1.4285714em;margin-top:1.6em;margin-bottom:.8em;line-height:1.4}.lg\:prose-sm h3{font-size:1.2857143em;margin-top:1.5555556em;margin-bottom:.4444444em;line-height:1.5555556}.lg\:prose-sm h4{margin-top:1.4285714em;margin-bottom:.5714286em;line-height:1.4285714}.lg\:prose-sm img{margin-top:1.7142857em;margin-bottom:1.7142857em}.lg\:prose-sm video{margin-top:1.7142857em;margin-bottom:1.7142857em}.lg\:prose-sm figure{margin-top:1.7142857em;margin-bottom:1.7142857em}.lg\:prose-sm figure>*{margin-top:0;margin-bottom:0}.lg\:prose-sm figure figcaption{font-size:.8571429em;line-height:1.3333333;margin-top:.6666667em}.lg\:prose-sm code{font-size:.8571429em}.lg\:prose-sm h2 code{font-size:.9em}.lg\:prose-sm h3 code{font-size:.8888889em}.lg\:prose-sm pre{font-size:.8571429em;line-height:1.6666667;margin-top:1.6666667em;margin-bottom:1.6666667em;border-radius:.25rem;padding-top:.6666667em;padding-right:1em;padding-bottom:.6666667em;padding-left:1em}.lg\:prose-sm ol{margin-top:1.1428571em;margin-bottom:1.1428571em}.lg\:prose-sm ul{margin-top:1.1428571em;margin-bottom:1.1428571em}.lg\:prose-sm li{margin-top:.2857143em;margin-bottom:.2857143em}.lg\:prose-sm ol>li{padding-left:1.5714286em}.lg\:prose-sm ol>li:before{left:0}.lg\:prose-sm ul>li{padding-left:1.5714286em}.lg\:prose-sm ul>li::before{height:.3571429em;width:.3571429em;top:calc(.8571429em - .1785714em);left:.2142857em}.lg\:prose-sm>ul>li p{margin-top:.5714286em;margin-bottom:.5714286em}.lg\:prose-sm>ul>li>:first-child{margin-top:1.1428571em}.lg\:prose-sm>ul>li>:last-child{margin-bottom:1.1428571em}.lg\:prose-sm>ol>li>:first-child{margin-top:1.1428571em}.lg\:prose-sm>ol>li>:last-child{margin-bottom:1.1428571em}.lg\:prose-sm ol ol,.lg\:prose-sm ol ul,.lg\:prose-sm ul ol,.lg\:prose-sm ul ul{margin-top:.5714286em;margin-bottom:.5714286em}.lg\:prose-sm hr{margin-top:2.8571429em;margin-bottom:2.8571429em}.lg\:prose-sm hr+*{margin-top:0}.lg\:prose-sm h2+*{margin-top:0}.lg\:prose-sm h3+*{margin-top:0}.lg\:prose-sm h4+*{margin-top:0}.lg\:prose-sm table{font-size:.8571429em;line-height:1.5}.lg\:prose-sm thead th{padding-right:1em;padding-bottom:.6666667em;padding-left:1em}.lg\:prose-sm thead th:first-child{padding-left:0}.lg\:prose-sm thead th:last-child{padding-right:0}.lg\:prose-sm tbody td{padding-top:.6666667em;padding-right:1em;padding-bottom:.6666667em;padding-left:1em}.lg\:prose-sm tbody td:first-child{padding-left:0}.lg\:prose-sm tbody td:last-child{padding-right:0}.lg\:prose-sm>:first-child{margin-top:0}.lg\:prose-sm>:last-child{margin-bottom:0}.lg\:prose-lg{font-size:1.125rem;line-height:1.7777778}.lg\:prose-lg p{margin-top:1.3333333em;margin-bottom:1.3333333em}.lg\:prose-lg [class~=lead]{font-size:1.2222222em;line-height:1.4545455;margin-top:1.0909091em;margin-bottom:1.0909091em}.lg\:prose-lg blockquote{margin-top:1.6666667em;margin-bottom:1.6666667em;padding-left:1em}.lg\:prose-lg h1{font-size:2.6666667em;margin-top:0;margin-bottom:.8333333em;line-height:1}.lg\:prose-lg h2{font-size:1.6666667em;margin-top:1.8666667em;margin-bottom:1.0666667em;line-height:1.3333333}.lg\:prose-lg h3{font-size:1.3333333em;margin-top:1.6666667em;margin-bottom:.6666667em;line-height:1.5}.lg\:prose-lg h4{margin-top:1.7777778em;margin-bottom:.4444444em;line-height:1.5555556}.lg\:prose-lg img{margin-top:1.7777778em;margin-bottom:1.7777778em}.lg\:prose-lg video{margin-top:1.7777778em;margin-bottom:1.7777778em}.lg\:prose-lg figure{margin-top:1.7777778em;margin-bottom:1.7777778em}.lg\:prose-lg figure>*{margin-top:0;margin-bottom:0}.lg\:prose-lg figure figcaption{font-size:.8888889em;line-height:1.5;margin-top:1em}.lg\:prose-lg code{font-size:.8888889em}.lg\:prose-lg h2 code{font-size:.8666667em}.lg\:prose-lg h3 code{font-size:.875em}.lg\:prose-lg pre{font-size:.8888889em;line-height:1.75;margin-top:2em;margin-bottom:2em;border-radius:.375rem;padding-top:1em;padding-right:1.5em;padding-bottom:1em;padding-left:1.5em}.lg\:prose-lg ol{margin-top:1.3333333em;margin-bottom:1.3333333em}.lg\:prose-lg ul{margin-top:1.3333333em;margin-bottom:1.3333333em}.lg\:prose-lg li{margin-top:.6666667em;margin-bottom:.6666667em}.lg\:prose-lg ol>li{padding-left:1.6666667em}.lg\:prose-lg ol>li:before{left:0}.lg\:prose-lg ul>li{padding-left:1.6666667em}.lg\:prose-lg ul>li::before{width:.3333333em;height:.3333333em;top:calc(.8888889em - .1666667em);left:.2222222em}.lg\:prose-lg>ul>li p{margin-top:.8888889em;margin-bottom:.8888889em}.lg\:prose-lg>ul>li>:first-child{margin-top:1.3333333em}.lg\:prose-lg>ul>li>:last-child{margin-bottom:1.3333333em}.lg\:prose-lg>ol>li>:first-child{margin-top:1.3333333em}.lg\:prose-lg>ol>li>:last-child{margin-bottom:1.3333333em}.lg\:prose-lg ol ol,.lg\:prose-lg ol ul,.lg\:prose-lg ul ol,.lg\:prose-lg ul ul{margin-top:.8888889em;margin-bottom:.8888889em}.lg\:prose-lg hr{margin-top:3.1111111em;margin-bottom:3.1111111em}.lg\:prose-lg hr+*{margin-top:0}.lg\:prose-lg h2+*{margin-top:0}.lg\:prose-lg h3+*{margin-top:0}.lg\:prose-lg h4+*{margin-top:0}.lg\:prose-lg table{font-size:.8888889em;line-height:1.5}.lg\:prose-lg thead th{padding-right:.75em;padding-bottom:.75em;padding-left:.75em}.lg\:prose-lg thead th:first-child{padding-left:0}.lg\:prose-lg thead th:last-child{padding-right:0}.lg\:prose-lg tbody td{padding-top:.75em;padding-right:.75em;padding-bottom:.75em;padding-left:.75em}.lg\:prose-lg tbody td:first-child{padding-left:0}.lg\:prose-lg tbody td:last-child{padding-right:0}.lg\:prose-lg>:first-child{margin-top:0}.lg\:prose-lg>:last-child{margin-bottom:0}.lg\:prose-xl{font-size:1.25rem;line-height:1.8}.lg\:prose-xl p{margin-top:1.2em;margin-bottom:1.2em}.lg\:prose-xl [class~=lead]{font-size:1.2em;line-height:1.5;margin-top:1em;margin-bottom:1em}.lg\:prose-xl blockquote{margin-top:1.6em;margin-bottom:1.6em;padding-left:1.0666667em}.lg\:prose-xl h1{font-size:2.8em;margin-top:0;margin-bottom:.8571429em;line-height:1}.lg\:prose-xl h2{font-size:1.8em;margin-top:1.5555556em;margin-bottom:.8888889em;line-height:1.1111111}.lg\:prose-xl h3{font-size:1.5em;margin-top:1.6em;margin-bottom:.6666667em;line-height:1.3333333}.lg\:prose-xl h4{margin-top:1.8em;margin-bottom:.6em;line-height:1.6}.lg\:prose-xl img{margin-top:2em;margin-bottom:2em}.lg\:prose-xl video{margin-top:2em;margin-bottom:2em}.lg\:prose-xl figure{margin-top:2em;margin-bottom:2em}.lg\:prose-xl figure>*{margin-top:0;margin-bottom:0}.lg\:prose-xl figure figcaption{font-size:.9em;line-height:1.5555556;margin-top:1em}.lg\:prose-xl code{font-size:.9em}.lg\:prose-xl h2 code{font-size:.8611111em}.lg\:prose-xl h3 code{font-size:.9em}.lg\:prose-xl pre{font-size:.9em;line-height:1.7777778;margin-top:2em;margin-bottom:2em;border-radius:.5rem;padding-top:1.1111111em;padding-right:1.3333333em;padding-bottom:1.1111111em;padding-left:1.3333333em}.lg\:prose-xl ol{margin-top:1.2em;margin-bottom:1.2em}.lg\:prose-xl ul{margin-top:1.2em;margin-bottom:1.2em}.lg\:prose-xl li{margin-top:.6em;margin-bottom:.6em}.lg\:prose-xl ol>li{padding-left:1.8em}.lg\:prose-xl ol>li:before{left:0}.lg\:prose-xl ul>li{padding-left:1.8em}.lg\:prose-xl ul>li::before{width:.35em;height:.35em;top:calc(.9em - .175em);left:.25em}.lg\:prose-xl>ul>li p{margin-top:.8em;margin-bottom:.8em}.lg\:prose-xl>ul>li>:first-child{margin-top:1.2em}.lg\:prose-xl>ul>li>:last-child{margin-bottom:1.2em}.lg\:prose-xl>ol>li>:first-child{margin-top:1.2em}.lg\:prose-xl>ol>li>:last-child{margin-bottom:1.2em}.lg\:prose-xl ol ol,.lg\:prose-xl ol ul,.lg\:prose-xl ul ol,.lg\:prose-xl ul ul{margin-top:.8em;margin-bottom:.8em}.lg\:prose-xl hr{margin-top:2.8em;margin-bottom:2.8em}.lg\:prose-xl hr+*{margin-top:0}.lg\:prose-xl h2+*{margin-top:0}.lg\:prose-xl h3+*{margin-top:0}.lg\:prose-xl h4+*{margin-top:0}.lg\:prose-xl table{font-size:.9em;line-height:1.5555556}.lg\:prose-xl thead th{padding-right:.6666667em;padding-bottom:.8888889em;padding-left:.6666667em}.lg\:prose-xl thead th:first-child{padding-left:0}.lg\:prose-xl thead th:last-child{padding-right:0}.lg\:prose-xl tbody td{padding-top:.8888889em;padding-right:.6666667em;padding-bottom:.8888889em;padding-left:.6666667em}.lg\:prose-xl tbody td:first-child{padding-left:0}.lg\:prose-xl tbody td:last-child{padding-right:0}.lg\:prose-xl>:first-child{margin-top:0}.lg\:prose-xl>:last-child{margin-bottom:0}.lg\:prose-2xl{font-size:1.5rem;line-height:1.6666667}.lg\:prose-2xl p{margin-top:1.3333333em;margin-bottom:1.3333333em}.lg\:prose-2xl [class~=lead]{font-size:1.25em;line-height:1.4666667;margin-top:1.0666667em;margin-bottom:1.0666667em}.lg\:prose-2xl blockquote{margin-top:1.7777778em;margin-bottom:1.7777778em;padding-left:1.1111111em}.lg\:prose-2xl h1{font-size:2.6666667em;margin-top:0;margin-bottom:.875em;line-height:1}.lg\:prose-2xl h2{font-size:2em;margin-top:1.5em;margin-bottom:.8333333em;line-height:1.0833333}.lg\:prose-2xl h3{font-size:1.5em;margin-top:1.5555556em;margin-bottom:.6666667em;line-height:1.2222222}.lg\:prose-2xl h4{margin-top:1.6666667em;margin-bottom:.6666667em;line-height:1.5}.lg\:prose-2xl img{margin-top:2em;margin-bottom:2em}.lg\:prose-2xl video{margin-top:2em;margin-bottom:2em}.lg\:prose-2xl figure{margin-top:2em;margin-bottom:2em}.lg\:prose-2xl figure>*{margin-top:0;margin-bottom:0}.lg\:prose-2xl figure figcaption{font-size:.8333333em;line-height:1.6;margin-top:1em}.lg\:prose-2xl code{font-size:.8333333em}.lg\:prose-2xl h2 code{font-size:.875em}.lg\:prose-2xl h3 code{font-size:.8888889em}.lg\:prose-2xl pre{font-size:.8333333em;line-height:1.8;margin-top:2em;margin-bottom:2em;border-radius:.5rem;padding-top:1.2em;padding-right:1.6em;padding-bottom:1.2em;padding-left:1.6em}.lg\:prose-2xl ol{margin-top:1.3333333em;margin-bottom:1.3333333em}.lg\:prose-2xl ul{margin-top:1.3333333em;margin-bottom:1.3333333em}.lg\:prose-2xl li{margin-top:.5em;margin-bottom:.5em}.lg\:prose-2xl ol>li{padding-left:1.6666667em}.lg\:prose-2xl ol>li:before{left:0}.lg\:prose-2xl ul>li{padding-left:1.6666667em}.lg\:prose-2xl ul>li::before{width:.3333333em;height:.3333333em;top:calc(.8333333em - .1666667em);left:.25em}.lg\:prose-2xl>ul>li p{margin-top:.8333333em;margin-bottom:.8333333em}.lg\:prose-2xl>ul>li>:first-child{margin-top:1.3333333em}.lg\:prose-2xl>ul>li>:last-child{margin-bottom:1.3333333em}.lg\:prose-2xl>ol>li>:first-child{margin-top:1.3333333em}.lg\:prose-2xl>ol>li>:last-child{margin-bottom:1.3333333em}.lg\:prose-2xl ol ol,.lg\:prose-2xl ol ul,.lg\:prose-2xl ul ol,.lg\:prose-2xl ul ul{margin-top:.6666667em;margin-bottom:.6666667em}.lg\:prose-2xl hr{margin-top:3em;margin-bottom:3em}.lg\:prose-2xl hr+*{margin-top:0}.lg\:prose-2xl h2+*{margin-top:0}.lg\:prose-2xl h3+*{margin-top:0}.lg\:prose-2xl h4+*{margin-top:0}.lg\:prose-2xl table{font-size:.8333333em;line-height:1.4}.lg\:prose-2xl thead th{padding-right:.6em;padding-bottom:.8em;padding-left:.6em}.lg\:prose-2xl thead th:first-child{padding-left:0}.lg\:prose-2xl thead th:last-child{padding-right:0}.lg\:prose-2xl tbody td{padding-top:.8em;padding-right:.6em;padding-bottom:.8em;padding-left:.6em}.lg\:prose-2xl tbody td:first-child{padding-left:0}.lg\:prose-2xl tbody td:last-child{padding-right:0}.lg\:prose-2xl>:first-child{margin-top:0}.lg\:prose-2xl>:last-child{margin-bottom:0}.lg\:space-y-0>:not(template)~:not(template){--space-y-reverse:0;margin-top:calc(0px * calc(1 - var(--space-y-reverse)));margin-bottom:calc(0px * var(--space-y-reverse))}.lg\:space-x-2>:not(template)~:not(template){--space-x-reverse:0;margin-right:calc(.5rem * var(--space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--space-x-reverse)))}.lg\:space-x-4>:not(template)~:not(template){--space-x-reverse:0;margin-right:calc(1rem * var(--space-x-reverse));margin-left:calc(1rem * calc(1 - var(--space-x-reverse)))}.lg\:space-y-20>:not(template)~:not(template){--space-y-reverse:0;margin-top:calc(5rem * calc(1 - var(--space-y-reverse)));margin-bottom:calc(5rem * var(--space-y-reverse))}.lg\:rounded-r-none{border-top-right-radius:0;border-bottom-right-radius:0}.lg\:rounded-l-none{border-top-left-radius:0;border-bottom-left-radius:0}.lg\:block{display:block}.lg\:flex{display:flex}.lg\:grid{display:grid}.lg\:hidden{display:none}.lg\:flex-row{flex-direction:row}.lg\:flex-col{flex-direction:column}.lg\:items-end{align-items:flex-end}.lg\:items-center{align-items:center}.lg\:justify-center{justify-content:center}.lg\:flex-1{flex:1 1 0%}.lg\:flex-grow{flex-grow:1}.lg\:flex-shrink{flex-shrink:1}.lg\:h-10{height:2.5rem}.lg\:h-1\/2{height:50%}.lg\:text-xl{font-size:1.25rem}.lg\:text-3xl{font-size:1.875rem}.lg\:text-5xl{font-size:3rem}.lg\:leading-none{line-height:1}.lg\:m-0{margin:0}.lg\:mx-0{margin-left:0;margin-right:0}.lg\:mt-0{margin-top:0}.lg\:mt-2{margin-top:.5rem}.lg\:mt-4{margin-top:1rem}.lg\:mt-20{margin-top:5rem}.lg\:mt-24{margin-top:6rem}.lg\:max-w-none{max-width:none}.lg\:max-w-4xl{max-width:56rem}.lg\:max-w-screen-xl{max-width:1280px}.lg\:p-12{padding:3rem}.lg\:px-8{padding-left:2rem;padding-right:2rem}.lg\:py-16{padding-top:4rem;padding-bottom:4rem}.lg\:pb-20{padding-bottom:5rem}.lg\:pt-24{padding-top:6rem}.lg\:w-10{width:2.5rem}.lg\:gap-8{grid-gap:2rem;gap:2rem}.lg\:grid-flow-row-dense{grid-auto-flow:row dense}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-7{grid-template-columns:repeat(7,minmax(0,1fr))}.lg\:col-start-1{grid-column-start:1}.lg\:col-start-2{grid-column-start:2}.lg\:col-start-3{grid-column-start:3}.lg\:col-start-6{grid-column-start:6}.lg\:col-end-3{grid-column-end:3}.lg\:col-end-6{grid-column-end:6}.lg\:col-end-8{grid-column-end:8}.lg\:row-start-1{grid-row-start:1}.lg\:row-start-2{grid-row-start:2}.lg\:row-end-3{grid-row-end:3}.lg\:row-end-4{grid-row-end:4}}@media (min-width:1280px){.xl\:container{width:100%}@media (min-width:640px){.xl\:container{max-width:640px}}@media (min-width:768px){.xl\:container{max-width:768px}}@media (min-width:1024px){.xl\:container{max-width:1024px}}@media (min-width:1280px){.xl\:container{max-width:1280px}}.xl\:prose{color:#374151;max-width:65ch}.xl\:prose [class~=lead]{color:#4b5563;font-size:1.25em;line-height:1.6;margin-top:1.2em;margin-bottom:1.2em}.xl\:prose a{color:#5850ec;text-decoration:none;font-weight:600}.xl\:prose strong{color:#161e2e;font-weight:600}.xl\:prose ol{counter-reset:list-counter;margin-top:1.25em;margin-bottom:1.25em}.xl\:prose ol>li{position:relative;counter-increment:list-counter;padding-left:1.75em}.xl\:prose ol>li::before{content:counter(list-counter) ".";position:absolute;font-weight:400;color:#6b7280}.xl\:prose ul>li{position:relative;padding-left:1.75em}.xl\:prose ul>li::before{content:"";position:absolute;background-color:#d2d6dc;border-radius:50%;width:.375em;height:.375em;top:calc(.875em - .1875em);left:.25em}.xl\:prose hr{border-color:#e5e7eb;border-top-width:1px;margin-top:3em;margin-bottom:3em}.xl\:prose blockquote{font-weight:500;font-style:italic;color:#161e2e;border-left-width:.25rem;border-left-color:#e5e7eb;quotes:"\201C""\201D""\2018""\2019";margin-top:1.6em;margin-bottom:1.6em;padding-left:1em}.xl\:prose blockquote p:first-of-type::before{content:open-quote}.xl\:prose blockquote p:last-of-type::after{content:close-quote}.xl\:prose h1{color:#1a202c;font-weight:800;font-size:2.25em;margin-top:0;margin-bottom:.8888889em;line-height:1.1111111}.xl\:prose h2{color:#1a202c;font-weight:700;font-size:1.5em;margin-top:2em;margin-bottom:1em;line-height:1.3333333}.xl\:prose h3{color:#1a202c;font-weight:600;font-size:1.25em;margin-top:1.6em;margin-bottom:.6em;line-height:1.6}.xl\:prose h4{color:#1a202c;font-weight:600;margin-top:1.5em;margin-bottom:.5em;line-height:1.5}.xl\:prose figure figcaption{color:#6b7280;font-size:.875em;line-height:1.4285714;margin-top:.8571429em}.xl\:prose code{color:#161e2e;font-weight:600;font-size:.875em}.xl\:prose code::before{content:"`"}.xl\:prose code::after{content:"`"}.xl\:prose pre{color:#e5e7eb;background-color:#252f3f;overflow-x:auto;font-size:.875em;line-height:1.7142857;margin-top:1.7142857em;margin-bottom:1.7142857em;border-radius:.375rem;padding-top:.8571429em;padding-right:1.1428571em;padding-bottom:.8571429em;padding-left:1.1428571em}.xl\:prose pre code{background-color:transparent;border-width:0;border-radius:0;padding:0;font-weight:400;color:inherit;font-size:inherit;font-family:inherit;line-height:inherit}.xl\:prose pre code::before{content:""}.xl\:prose pre code::after{content:""}.xl\:prose table{width:100%;table-layout:auto;text-align:left;margin-top:2em;margin-bottom:2em;font-size:.875em;line-height:1.7142857}.xl\:prose thead{color:#161e2e;font-weight:600;border-bottom-width:1px;border-bottom-color:#d2d6dc}.xl\:prose thead th{vertical-align:bottom;padding-right:.5714286em;padding-bottom:.5714286em;padding-left:.5714286em}.xl\:prose tbody tr{border-bottom-width:1px;border-bottom-color:#e5e7eb}.xl\:prose tbody tr:last-child{border-bottom-width:0}.xl\:prose tbody td{vertical-align:top;padding-top:.5714286em;padding-right:.5714286em;padding-bottom:.5714286em;padding-left:.5714286em}.xl\:prose{font-size:1rem;line-height:1.75}.xl\:prose p{margin-top:1.25em;margin-bottom:1.25em}.xl\:prose img{margin-top:2em;margin-bottom:2em}.xl\:prose video{margin-top:2em;margin-bottom:2em}.xl\:prose figure{margin-top:2em;margin-bottom:2em}.xl\:prose figure>*{margin-top:0;margin-bottom:0}.xl\:prose h2 code{font-size:.875em}.xl\:prose h3 code{font-size:.9em}.xl\:prose ul{margin-top:1.25em;margin-bottom:1.25em}.xl\:prose li{margin-top:.5em;margin-bottom:.5em}.xl\:prose ol>li:before{left:0}.xl\:prose>ul>li p{margin-top:.75em;margin-bottom:.75em}.xl\:prose>ul>li>:first-child{margin-top:1.25em}.xl\:prose>ul>li>:last-child{margin-bottom:1.25em}.xl\:prose>ol>li>:first-child{margin-top:1.25em}.xl\:prose>ol>li>:last-child{margin-bottom:1.25em}.xl\:prose ol ol,.xl\:prose ol ul,.xl\:prose ul ol,.xl\:prose ul ul{margin-top:.75em;margin-bottom:.75em}.xl\:prose hr+*{margin-top:0}.xl\:prose h2+*{margin-top:0}.xl\:prose h3+*{margin-top:0}.xl\:prose h4+*{margin-top:0}.xl\:prose thead th:first-child{padding-left:0}.xl\:prose thead th:last-child{padding-right:0}.xl\:prose tbody td:first-child{padding-left:0}.xl\:prose tbody td:last-child{padding-right:0}.xl\:prose>:first-child{margin-top:0}.xl\:prose>:last-child{margin-bottom:0}.xl\:prose h1,.xl\:prose h2,.xl\:prose h3,.xl\:prose h4{color:#161e2e}.xl\:prose-sm{font-size:.875rem;line-height:1.7142857}.xl\:prose-sm p{margin-top:1.1428571em;margin-bottom:1.1428571em}.xl\:prose-sm [class~=lead]{font-size:1.2857143em;line-height:1.5555556;margin-top:.8888889em;margin-bottom:.8888889em}.xl\:prose-sm blockquote{margin-top:1.3333333em;margin-bottom:1.3333333em;padding-left:1.1111111em}.xl\:prose-sm h1{font-size:2.1428571em;margin-top:0;margin-bottom:.8em;line-height:1.2}.xl\:prose-sm h2{font-size:1.4285714em;margin-top:1.6em;margin-bottom:.8em;line-height:1.4}.xl\:prose-sm h3{font-size:1.2857143em;margin-top:1.5555556em;margin-bottom:.4444444em;line-height:1.5555556}.xl\:prose-sm h4{margin-top:1.4285714em;margin-bottom:.5714286em;line-height:1.4285714}.xl\:prose-sm img{margin-top:1.7142857em;margin-bottom:1.7142857em}.xl\:prose-sm video{margin-top:1.7142857em;margin-bottom:1.7142857em}.xl\:prose-sm figure{margin-top:1.7142857em;margin-bottom:1.7142857em}.xl\:prose-sm figure>*{margin-top:0;margin-bottom:0}.xl\:prose-sm figure figcaption{font-size:.8571429em;line-height:1.3333333;margin-top:.6666667em}.xl\:prose-sm code{font-size:.8571429em}.xl\:prose-sm h2 code{font-size:.9em}.xl\:prose-sm h3 code{font-size:.8888889em}.xl\:prose-sm pre{font-size:.8571429em;line-height:1.6666667;margin-top:1.6666667em;margin-bottom:1.6666667em;border-radius:.25rem;padding-top:.6666667em;padding-right:1em;padding-bottom:.6666667em;padding-left:1em}.xl\:prose-sm ol{margin-top:1.1428571em;margin-bottom:1.1428571em}.xl\:prose-sm ul{margin-top:1.1428571em;margin-bottom:1.1428571em}.xl\:prose-sm li{margin-top:.2857143em;margin-bottom:.2857143em}.xl\:prose-sm ol>li{padding-left:1.5714286em}.xl\:prose-sm ol>li:before{left:0}.xl\:prose-sm ul>li{padding-left:1.5714286em}.xl\:prose-sm ul>li::before{height:.3571429em;width:.3571429em;top:calc(.8571429em - .1785714em);left:.2142857em}.xl\:prose-sm>ul>li p{margin-top:.5714286em;margin-bottom:.5714286em}.xl\:prose-sm>ul>li>:first-child{margin-top:1.1428571em}.xl\:prose-sm>ul>li>:last-child{margin-bottom:1.1428571em}.xl\:prose-sm>ol>li>:first-child{margin-top:1.1428571em}.xl\:prose-sm>ol>li>:last-child{margin-bottom:1.1428571em}.xl\:prose-sm ol ol,.xl\:prose-sm ol ul,.xl\:prose-sm ul ol,.xl\:prose-sm ul ul{margin-top:.5714286em;margin-bottom:.5714286em}.xl\:prose-sm hr{margin-top:2.8571429em;margin-bottom:2.8571429em}.xl\:prose-sm hr+*{margin-top:0}.xl\:prose-sm h2+*{margin-top:0}.xl\:prose-sm h3+*{margin-top:0}.xl\:prose-sm h4+*{margin-top:0}.xl\:prose-sm table{font-size:.8571429em;line-height:1.5}.xl\:prose-sm thead th{padding-right:1em;padding-bottom:.6666667em;padding-left:1em}.xl\:prose-sm thead th:first-child{padding-left:0}.xl\:prose-sm thead th:last-child{padding-right:0}.xl\:prose-sm tbody td{padding-top:.6666667em;padding-right:1em;padding-bottom:.6666667em;padding-left:1em}.xl\:prose-sm tbody td:first-child{padding-left:0}.xl\:prose-sm tbody td:last-child{padding-right:0}.xl\:prose-sm>:first-child{margin-top:0}.xl\:prose-sm>:last-child{margin-bottom:0}.xl\:prose-lg{font-size:1.125rem;line-height:1.7777778}.xl\:prose-lg p{margin-top:1.3333333em;margin-bottom:1.3333333em}.xl\:prose-lg [class~=lead]{font-size:1.2222222em;line-height:1.4545455;margin-top:1.0909091em;margin-bottom:1.0909091em}.xl\:prose-lg blockquote{margin-top:1.6666667em;margin-bottom:1.6666667em;padding-left:1em}.xl\:prose-lg h1{font-size:2.6666667em;margin-top:0;margin-bottom:.8333333em;line-height:1}.xl\:prose-lg h2{font-size:1.6666667em;margin-top:1.8666667em;margin-bottom:1.0666667em;line-height:1.3333333}.xl\:prose-lg h3{font-size:1.3333333em;margin-top:1.6666667em;margin-bottom:.6666667em;line-height:1.5}.xl\:prose-lg h4{margin-top:1.7777778em;margin-bottom:.4444444em;line-height:1.5555556}.xl\:prose-lg img{margin-top:1.7777778em;margin-bottom:1.7777778em}.xl\:prose-lg video{margin-top:1.7777778em;margin-bottom:1.7777778em}.xl\:prose-lg figure{margin-top:1.7777778em;margin-bottom:1.7777778em}.xl\:prose-lg figure>*{margin-top:0;margin-bottom:0}.xl\:prose-lg figure figcaption{font-size:.8888889em;line-height:1.5;margin-top:1em}.xl\:prose-lg code{font-size:.8888889em}.xl\:prose-lg h2 code{font-size:.8666667em}.xl\:prose-lg h3 code{font-size:.875em}.xl\:prose-lg pre{font-size:.8888889em;line-height:1.75;margin-top:2em;margin-bottom:2em;border-radius:.375rem;padding-top:1em;padding-right:1.5em;padding-bottom:1em;padding-left:1.5em}.xl\:prose-lg ol{margin-top:1.3333333em;margin-bottom:1.3333333em}.xl\:prose-lg ul{margin-top:1.3333333em;margin-bottom:1.3333333em}.xl\:prose-lg li{margin-top:.6666667em;margin-bottom:.6666667em}.xl\:prose-lg ol>li{padding-left:1.6666667em}.xl\:prose-lg ol>li:before{left:0}.xl\:prose-lg ul>li{padding-left:1.6666667em}.xl\:prose-lg ul>li::before{width:.3333333em;height:.3333333em;top:calc(.8888889em - .1666667em);left:.2222222em}.xl\:prose-lg>ul>li p{margin-top:.8888889em;margin-bottom:.8888889em}.xl\:prose-lg>ul>li>:first-child{margin-top:1.3333333em}.xl\:prose-lg>ul>li>:last-child{margin-bottom:1.3333333em}.xl\:prose-lg>ol>li>:first-child{margin-top:1.3333333em}.xl\:prose-lg>ol>li>:last-child{margin-bottom:1.3333333em}.xl\:prose-lg ol ol,.xl\:prose-lg ol ul,.xl\:prose-lg ul ol,.xl\:prose-lg ul ul{margin-top:.8888889em;margin-bottom:.8888889em}.xl\:prose-lg hr{margin-top:3.1111111em;margin-bottom:3.1111111em}.xl\:prose-lg hr+*{margin-top:0}.xl\:prose-lg h2+*{margin-top:0}.xl\:prose-lg h3+*{margin-top:0}.xl\:prose-lg h4+*{margin-top:0}.xl\:prose-lg table{font-size:.8888889em;line-height:1.5}.xl\:prose-lg thead th{padding-right:.75em;padding-bottom:.75em;padding-left:.75em}.xl\:prose-lg thead th:first-child{padding-left:0}.xl\:prose-lg thead th:last-child{padding-right:0}.xl\:prose-lg tbody td{padding-top:.75em;padding-right:.75em;padding-bottom:.75em;padding-left:.75em}.xl\:prose-lg tbody td:first-child{padding-left:0}.xl\:prose-lg tbody td:last-child{padding-right:0}.xl\:prose-lg>:first-child{margin-top:0}.xl\:prose-lg>:last-child{margin-bottom:0}.xl\:prose-xl{font-size:1.25rem;line-height:1.8}.xl\:prose-xl p{margin-top:1.2em;margin-bottom:1.2em}.xl\:prose-xl [class~=lead]{font-size:1.2em;line-height:1.5;margin-top:1em;margin-bottom:1em}.xl\:prose-xl blockquote{margin-top:1.6em;margin-bottom:1.6em;padding-left:1.0666667em}.xl\:prose-xl h1{font-size:2.8em;margin-top:0;margin-bottom:.8571429em;line-height:1}.xl\:prose-xl h2{font-size:1.8em;margin-top:1.5555556em;margin-bottom:.8888889em;line-height:1.1111111}.xl\:prose-xl h3{font-size:1.5em;margin-top:1.6em;margin-bottom:.6666667em;line-height:1.3333333}.xl\:prose-xl h4{margin-top:1.8em;margin-bottom:.6em;line-height:1.6}.xl\:prose-xl img{margin-top:2em;margin-bottom:2em}.xl\:prose-xl video{margin-top:2em;margin-bottom:2em}.xl\:prose-xl figure{margin-top:2em;margin-bottom:2em}.xl\:prose-xl figure>*{margin-top:0;margin-bottom:0}.xl\:prose-xl figure figcaption{font-size:.9em;line-height:1.5555556;margin-top:1em}.xl\:prose-xl code{font-size:.9em}.xl\:prose-xl h2 code{font-size:.8611111em}.xl\:prose-xl h3 code{font-size:.9em}.xl\:prose-xl pre{font-size:.9em;line-height:1.7777778;margin-top:2em;margin-bottom:2em;border-radius:.5rem;padding-top:1.1111111em;padding-right:1.3333333em;padding-bottom:1.1111111em;padding-left:1.3333333em}.xl\:prose-xl ol{margin-top:1.2em;margin-bottom:1.2em}.xl\:prose-xl ul{margin-top:1.2em;margin-bottom:1.2em}.xl\:prose-xl li{margin-top:.6em;margin-bottom:.6em}.xl\:prose-xl ol>li{padding-left:1.8em}.xl\:prose-xl ol>li:before{left:0}.xl\:prose-xl ul>li{padding-left:1.8em}.xl\:prose-xl ul>li::before{width:.35em;height:.35em;top:calc(.9em - .175em);left:.25em}.xl\:prose-xl>ul>li p{margin-top:.8em;margin-bottom:.8em}.xl\:prose-xl>ul>li>:first-child{margin-top:1.2em}.xl\:prose-xl>ul>li>:last-child{margin-bottom:1.2em}.xl\:prose-xl>ol>li>:first-child{margin-top:1.2em}.xl\:prose-xl>ol>li>:last-child{margin-bottom:1.2em}.xl\:prose-xl ol ol,.xl\:prose-xl ol ul,.xl\:prose-xl ul ol,.xl\:prose-xl ul ul{margin-top:.8em;margin-bottom:.8em}.xl\:prose-xl hr{margin-top:2.8em;margin-bottom:2.8em}.xl\:prose-xl hr+*{margin-top:0}.xl\:prose-xl h2+*{margin-top:0}.xl\:prose-xl h3+*{margin-top:0}.xl\:prose-xl h4+*{margin-top:0}.xl\:prose-xl table{font-size:.9em;line-height:1.5555556}.xl\:prose-xl thead th{padding-right:.6666667em;padding-bottom:.8888889em;padding-left:.6666667em}.xl\:prose-xl thead th:first-child{padding-left:0}.xl\:prose-xl thead th:last-child{padding-right:0}.xl\:prose-xl tbody td{padding-top:.8888889em;padding-right:.6666667em;padding-bottom:.8888889em;padding-left:.6666667em}.xl\:prose-xl tbody td:first-child{padding-left:0}.xl\:prose-xl tbody td:last-child{padding-right:0}.xl\:prose-xl>:first-child{margin-top:0}.xl\:prose-xl>:last-child{margin-bottom:0}.xl\:prose-2xl{font-size:1.5rem;line-height:1.6666667}.xl\:prose-2xl p{margin-top:1.3333333em;margin-bottom:1.3333333em}.xl\:prose-2xl [class~=lead]{font-size:1.25em;line-height:1.4666667;margin-top:1.0666667em;margin-bottom:1.0666667em}.xl\:prose-2xl blockquote{margin-top:1.7777778em;margin-bottom:1.7777778em;padding-left:1.1111111em}.xl\:prose-2xl h1{font-size:2.6666667em;margin-top:0;margin-bottom:.875em;line-height:1}.xl\:prose-2xl h2{font-size:2em;margin-top:1.5em;margin-bottom:.8333333em;line-height:1.0833333}.xl\:prose-2xl h3{font-size:1.5em;margin-top:1.5555556em;margin-bottom:.6666667em;line-height:1.2222222}.xl\:prose-2xl h4{margin-top:1.6666667em;margin-bottom:.6666667em;line-height:1.5}.xl\:prose-2xl img{margin-top:2em;margin-bottom:2em}.xl\:prose-2xl video{margin-top:2em;margin-bottom:2em}.xl\:prose-2xl figure{margin-top:2em;margin-bottom:2em}.xl\:prose-2xl figure>*{margin-top:0;margin-bottom:0}.xl\:prose-2xl figure figcaption{font-size:.8333333em;line-height:1.6;margin-top:1em}.xl\:prose-2xl code{font-size:.8333333em}.xl\:prose-2xl h2 code{font-size:.875em}.xl\:prose-2xl h3 code{font-size:.8888889em}.xl\:prose-2xl pre{font-size:.8333333em;line-height:1.8;margin-top:2em;margin-bottom:2em;border-radius:.5rem;padding-top:1.2em;padding-right:1.6em;padding-bottom:1.2em;padding-left:1.6em}.xl\:prose-2xl ol{margin-top:1.3333333em;margin-bottom:1.3333333em}.xl\:prose-2xl ul{margin-top:1.3333333em;margin-bottom:1.3333333em}.xl\:prose-2xl li{margin-top:.5em;margin-bottom:.5em}.xl\:prose-2xl ol>li{padding-left:1.6666667em}.xl\:prose-2xl ol>li:before{left:0}.xl\:prose-2xl ul>li{padding-left:1.6666667em}.xl\:prose-2xl ul>li::before{width:.3333333em;height:.3333333em;top:calc(.8333333em - .1666667em);left:.25em}.xl\:prose-2xl>ul>li p{margin-top:.8333333em;margin-bottom:.8333333em}.xl\:prose-2xl>ul>li>:first-child{margin-top:1.3333333em}.xl\:prose-2xl>ul>li>:last-child{margin-bottom:1.3333333em}.xl\:prose-2xl>ol>li>:first-child{margin-top:1.3333333em}.xl\:prose-2xl>ol>li>:last-child{margin-bottom:1.3333333em}.xl\:prose-2xl ol ol,.xl\:prose-2xl ol ul,.xl\:prose-2xl ul ol,.xl\:prose-2xl ul ul{margin-top:.6666667em;margin-bottom:.6666667em}.xl\:prose-2xl hr{margin-top:3em;margin-bottom:3em}.xl\:prose-2xl hr+*{margin-top:0}.xl\:prose-2xl h2+*{margin-top:0}.xl\:prose-2xl h3+*{margin-top:0}.xl\:prose-2xl h4+*{margin-top:0}.xl\:prose-2xl table{font-size:.8333333em;line-height:1.4}.xl\:prose-2xl thead th{padding-right:.6em;padding-bottom:.8em;padding-left:.6em}.xl\:prose-2xl thead th:first-child{padding-left:0}.xl\:prose-2xl thead th:last-child{padding-right:0}.xl\:prose-2xl tbody td{padding-top:.8em;padding-right:.6em;padding-bottom:.8em;padding-left:.6em}.xl\:prose-2xl tbody td:first-child{padding-left:0}.xl\:prose-2xl tbody td:last-child{padding-right:0}.xl\:prose-2xl>:first-child{margin-top:0}.xl\:prose-2xl>:last-child{margin-bottom:0}.xl\:space-y-24>:not(template)~:not(template){--space-y-reverse:0;margin-top:calc(6rem * calc(1 - var(--space-y-reverse)));margin-bottom:calc(6rem * var(--space-y-reverse))}.xl\:max-w-6xl{max-width:72rem}} \ No newline at end of file diff --git a/webviews/1.0.1/i/code.jpg b/webviews/1.0.1/i/code.jpg new file mode 100644 index 0000000..20dc40a Binary files /dev/null and b/webviews/1.0.1/i/code.jpg differ diff --git a/webviews/1.0.1/i/icon.png b/webviews/1.0.1/i/icon.png new file mode 100644 index 0000000..6789517 Binary files /dev/null and b/webviews/1.0.1/i/icon.png differ diff --git a/webviews/1.0.1/index.html b/webviews/1.0.1/index.html new file mode 100644 index 0000000..41d9f23 --- /dev/null +++ b/webviews/1.0.1/index.html @@ -0,0 +1,711 @@ + + + + + + + + Codestin Search App + + + + + +
+
+
+
+ +
+ +
+
+

+ Manage your +
+ + PHP + class + properties + +

+
+
+ +
+
+
+ + + +
+
+

+ The first stable release is finally here! +

+
+

+ It's been a long road, but I'm super excited to finally have a stable version +

+
+
+ +
+
+
+
+
+
+
+ + +
+

+ What's New in v1.0.0 +

+

+ This release is a rewrite of the extension to use a PHP parser and reduce the usage of RegExp, + but does include some exciting changes too. +

+
+ +
+
+

+ New code +

+

+ Over time, working on new features was giving me a hard time. +
+ Using RegExp was okay at the beginning, but adding more complex behaviors was introducing more + and more edge cases. +

+ +
    +
  • +
    +
    +
    + + + + +
    +
    +
    +
    PHP parser +
    +

    + Rewritten from scratch to use a PHP parser instead of RegExp +

    +
    +
    +
  • +
  • +
    +
    +
    + + + +
    +
    +
    +
    Typed JavaScript
    +

    + Less bugs, faster development +

    +
    +
    +
  • +
+
+ +
+ + + + + + + + + +
+
+ + + +
+
+
+

+ New features +

+

+ With the confidence that the PHP parser gives me, I was able to implement all the new + features that I had been thinking about for a long time. +

+ +
    +
  • +
    +
    +
    + + + + +
    +
    +
    +
    Remove properties
    +

    + Delete the properties you no longer use +

    +
    +
    +
  • +
  • +
    +
    +
    + + + + +
    +
    +
    +
    Edit properties
    +
    +
      +
    • Rename
    • +
    • Change type
    • +
    +
    +
    +
    +
  • +
  • +
    +
    +
    + + + +
    +
    +
    +
    Multiline contructor + command
    +

    + Break contructors into multiple lines using the command palette +

    +
    +
    +
  • +
+
+ +
+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+
+
+
+
+
+

+ Support my work +

+

+ Do you find my extension useful? +

+

+ This extension is free and open source, available to all, and will always stay that way. +
+ If you'd like to help support me, thank you! +

+
+
+
+
+
+
+
+
+
+
+
+
+

+ Buy me a tea +

+ +
+ +
+
+
+
+
+
+
+
+
+ + Preferred + +
+
+
+
+

+ Sponsor via Github +

+

+ From + $ + 6 + /month +

+ +
+
+
+
+
+
+
+
+

+ Buy the world a tree +

+ +
+ +
+
+
+
+
+
+ +
+
+
+
+
+
+

+ Corporate Sponsorship +

+

+ You are a company (or an individual on behalf of a company/team) that benefits + from this extension and would like to support me. +

+
+
+

+ What's included +

+
+
+
    +
  • +
    + + + +
    +

    + Your name, company name or logo and a link on this page or github + readme +

    +
  • +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ Interested in sponsoring, or partnering and have a different proposal? + + partnership@gustavoreal.com + +
+
+
+
+
+
+
+
+ +
+
+

+ Please consider help me reach out to wider audiences +

+ +
+
+
+
+ + +