diff --git a/build-tests/rush-stack-compiler-5.3-library-test/.eslintrc.js b/build-tests/rush-stack-compiler-5.3-library-test/.eslintrc.js new file mode 100644 index 0000000..3b54e03 --- /dev/null +++ b/build-tests/rush-stack-compiler-5.3-library-test/.eslintrc.js @@ -0,0 +1,7 @@ +// This is a workaround for https://github.com/eslint/eslint/issues/3458 +require('@rushstack/eslint-config/patch/modern-module-resolution'); + +module.exports = { + extends: ['@rushstack/eslint-config/profile/node', '@rushstack/eslint-config/mixins/friendly-locals'], + parserOptions: { tsconfigRootDir: __dirname } +}; diff --git a/build-tests/rush-stack-compiler-5.3-library-test/config/rush-project.json b/build-tests/rush-stack-compiler-5.3-library-test/config/rush-project.json new file mode 100644 index 0000000..247dc17 --- /dev/null +++ b/build-tests/rush-stack-compiler-5.3-library-test/config/rush-project.json @@ -0,0 +1,8 @@ +{ + "operationSettings": [ + { + "operationName": "build", + "outputFolderNames": ["lib", "dist"] + } + ] +} diff --git a/build-tests/rush-stack-compiler-5.3-library-test/gulpfile.js b/build-tests/rush-stack-compiler-5.3-library-test/gulpfile.js new file mode 100644 index 0000000..15c57b0 --- /dev/null +++ b/build-tests/rush-stack-compiler-5.3-library-test/gulpfile.js @@ -0,0 +1,9 @@ +'use strict'; + +const build = require('@microsoft/node-library-build'); + +// This project doesn't have unit tests and GCB's Mocha doesn't play nice with Node 14, so disable Mocha +build.mocha.enabled = false; +build.instrument.enabled = false; + +build.initialize(require('gulp')); diff --git a/build-tests/rush-stack-compiler-5.3-library-test/package.json b/build-tests/rush-stack-compiler-5.3-library-test/package.json new file mode 100644 index 0000000..be0447e --- /dev/null +++ b/build-tests/rush-stack-compiler-5.3-library-test/package.json @@ -0,0 +1,19 @@ +{ + "name": "rush-stack-compiler-5.3-library-test", + "version": "1.0.0", + "description": "", + "main": "lib/index.js", + "license": "MIT", + "private": true, + "scripts": { + "build": "gulp test --clean" + }, + "devDependencies": { + "@microsoft/node-library-build": "workspace:*", + "@microsoft/rush-stack-compiler-5.3": "workspace:*", + "@rushstack/eslint-config": "~2.6.2", + "@types/node": "10.17.13", + "eslint": "~7.12.1", + "gulp": "~4.0.2" + } +} diff --git a/build-tests/rush-stack-compiler-5.3-library-test/src/TestClass.ts b/build-tests/rush-stack-compiler-5.3-library-test/src/TestClass.ts new file mode 100644 index 0000000..c112710 --- /dev/null +++ b/build-tests/rush-stack-compiler-5.3-library-test/src/TestClass.ts @@ -0,0 +1,4 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. +// See LICENSE in the project root for license information. + +export class TestClass {} diff --git a/build-tests/rush-stack-compiler-5.3-library-test/tsconfig.json b/build-tests/rush-stack-compiler-5.3-library-test/tsconfig.json new file mode 100644 index 0000000..991efac --- /dev/null +++ b/build-tests/rush-stack-compiler-5.3-library-test/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/@microsoft/rush-stack-compiler-5.3/includes/tsconfig-node.json" +} diff --git a/common/changes/@microsoft/rush-stack-compiler-5.3/ts-5.3_2024-03-26-16-58.json b/common/changes/@microsoft/rush-stack-compiler-5.3/ts-5.3_2024-03-26-16-58.json new file mode 100644 index 0000000..24ef997 --- /dev/null +++ b/common/changes/@microsoft/rush-stack-compiler-5.3/ts-5.3_2024-03-26-16-58.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@microsoft/rush-stack-compiler-5.3", + "comment": "Initial package creation.", + "type": "minor" + } + ], + "packageName": "@microsoft/rush-stack-compiler-5.3" +} \ No newline at end of file diff --git a/common/config/rush/browser-approved-packages.json b/common/config/rush/browser-approved-packages.json index 34c3a91..e6fd2ff 100644 --- a/common/config/rush/browser-approved-packages.json +++ b/common/config/rush/browser-approved-packages.json @@ -1,5 +1,10 @@ // DO NOT ADD COMMENTS IN THIS FILE. They will be lost when the Rush tool resaves it. { "$schema": "https://developer.microsoft.com/json-schemas/rush/v5/approved-packages.schema.json", - "packages": [] + "packages": [ + { + "name": "@microsoft/rush-stack-compiler-5.3", + "allowedCategories": [ "tests" ] + } + ] } diff --git a/common/config/rush/common-versions.json b/common/config/rush/common-versions.json index 5e39e79..583db2a 100644 --- a/common/config/rush/common-versions.json +++ b/common/config/rush/common-versions.json @@ -28,7 +28,7 @@ // From the allowedAlternativeVersions list below, this should be the TypeScript version that's used to // build most of the projects in the repo. Preferring it avoids errors for indirect dependencies // that request it as a peer dependency. - "typescript": "~3.9.7", + "typescript": "~5.3.3", // Workaround for https://github.com/microsoft/rushstack/issues/1466 "eslint": "~7.12.1" @@ -71,6 +71,7 @@ "~3.0.3", "~3.1.6", "~3.2.4", + "~3.3.3", "~3.4.3", "~3.5.3", "~3.6.4", diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 042d4c4..a0d9be1 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -337,6 +337,22 @@ importers: eslint: 7.12.1 gulp: 4.0.2 + ../../build-tests/rush-stack-compiler-5.3-library-test: + specifiers: + '@microsoft/node-library-build': workspace:* + '@microsoft/rush-stack-compiler-5.3': workspace:* + '@rushstack/eslint-config': ~2.6.2 + '@types/node': 10.17.13 + eslint: ~7.12.1 + gulp: ~4.0.2 + devDependencies: + '@microsoft/node-library-build': link:../../core-build/node-library-build + '@microsoft/rush-stack-compiler-5.3': link:../../stack/rush-stack-compiler-5.3 + '@rushstack/eslint-config': 2.6.2_eslint@7.12.1 + '@types/node': 10.17.13 + eslint: 7.12.1 + gulp: 4.0.2 + ../../build-tests/web-library-build-test: specifiers: '@microsoft/load-themed-styles': ~1.10.172 @@ -1274,6 +1290,31 @@ importers: '@rushstack/heft': 0.48.0 '@rushstack/heft-node-rig': 1.11.0_@rushstack+heft@0.48.0 + ../../stack/rush-stack-compiler-5.3: + specifiers: + '@microsoft/api-extractor': ~7.15.2 + '@microsoft/rush-stack-compiler-4.7': workspace:* + '@microsoft/rush-stack-compiler-shared': workspace:* + '@rushstack/eslint-config': ~2.6.2 + '@rushstack/heft': 0.48.0 + '@rushstack/heft-node-rig': 1.11.0 + '@rushstack/node-core-library': ~3.53.0 + '@types/node': 10.17.13 + import-lazy: ~4.0.0 + typescript: ~5.3.3 + dependencies: + '@microsoft/api-extractor': 7.15.2 + '@rushstack/eslint-config': 2.6.2 + '@rushstack/node-core-library': 3.53.0 + '@types/node': 10.17.13 + import-lazy: 4.0.0 + typescript: 5.3.3 + devDependencies: + '@microsoft/rush-stack-compiler-4.7': link:../rush-stack-compiler-4.7 + '@microsoft/rush-stack-compiler-shared': link:../rush-stack-compiler-shared + '@rushstack/heft': 0.48.0 + '@rushstack/heft-node-rig': 1.11.0_@rushstack+heft@0.48.0 + ../../stack/rush-stack-compiler-shared: specifiers: {} @@ -3258,12 +3299,12 @@ packages: dependencies: acorn: 7.4.1 - /acorn-jsx/5.3.2_acorn@8.7.1: + /acorn-jsx/5.3.2_acorn@8.11.3: resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} peerDependencies: acorn: ^6.0.0 || ^7.0.0 || ^8.0.0 dependencies: - acorn: 8.7.1 + acorn: 8.11.3 dev: true /acorn-walk/6.2.0: @@ -3294,12 +3335,12 @@ packages: resolution: {integrity: sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==} engines: {node: '>=0.4.0'} hasBin: true - dev: false /acorn/8.7.1: resolution: {integrity: sha512-Xx54uLJQZ19lKygFXOWsscKUbsBZW0CPykPhVQdhIeIwrbPmJzqeASDInc8nKBnp/JT6igTs82qPXz069H8I/A==} engines: {node: '>=0.4.0'} hasBin: true + dev: false /agent-base/6.0.2: resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==} @@ -4511,6 +4552,7 @@ packages: /domexception/2.0.1: resolution: {integrity: sha512-yxJ2mFy/sibVQlu5qHjOkf9J3K6zgmCxgJ94u2EdvDOV09H+32LtRswEcUsmUWN72pVLOEnTSRaIVVzVQgS0dg==} engines: {node: '>=8'} + deprecated: Use your platform's native DOMException instead dependencies: webidl-conversions: 5.0.0 dev: true @@ -4962,8 +5004,8 @@ packages: resolution: {integrity: sha512-D211tC7ZwouTIuY5x9XnS0E9sWNChB7IYKX/Xp5eQj3nFXhqmiUDB9q27y76oFl8jTg3pXcQx/bpxMfs3CIZbA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: - acorn: 8.7.1 - acorn-jsx: 5.3.2_acorn@8.7.1 + acorn: 8.11.3 + acorn-jsx: 5.3.2_acorn@8.11.3 eslint-visitor-keys: 3.3.0 dev: true @@ -7163,7 +7205,7 @@ packages: jest-runtime: 27.5.1 jest-util: 27.5.1 jest-worker: 27.5.1 - source-map-support: 0.5.19 + source-map-support: 0.5.21 throat: 6.0.1 transitivePeerDependencies: - bufferutil @@ -7533,7 +7575,7 @@ packages: optional: true dependencies: abab: 2.0.5 - acorn: 8.7.1 + acorn: 8.11.3 acorn-globals: 6.0.0 cssom: 0.4.4 cssstyle: 2.3.0 @@ -9439,7 +9481,6 @@ packages: dependencies: buffer-from: 1.1.1 source-map: 0.6.1 - dev: false /source-map-url/0.4.1: resolution: {integrity: sha512-cPiFOTLUKvJFIg4SKVScy4ilPPW6rFgMgfuZJPNoDuMs3nC1HbMUycBoJw77xFIp6z1UJQJOfx6C9GMH80DiTw==} @@ -10891,6 +10932,12 @@ packages: engines: {node: '>=4.2.0'} hasBin: true + /typescript/5.3.3: + resolution: {integrity: sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==} + engines: {node: '>=14.17'} + hasBin: true + dev: false + /uglify-js/3.13.7: resolution: {integrity: sha512-1Psi2MmnZJbnEsgJJIlfnd7tFlJfitusmR7zDI8lXlFI0ACD4/Rm/xdrU8bh6zF0i74aiVoBtkRiFulkrmh3AA==} engines: {node: '>=0.8.0'} diff --git a/common/config/rush/repo-state.json b/common/config/rush/repo-state.json index eebd936..a3da280 100644 --- a/common/config/rush/repo-state.json +++ b/common/config/rush/repo-state.json @@ -1,5 +1,5 @@ // DO NOT MODIFY THIS FILE MANUALLY BUT DO COMMIT IT. It is generated and used by Rush. { - "pnpmShrinkwrapHash": "5222b83155bac93bc27dafd5bf79bec38e1aa1ae", - "preferredVersionsHash": "6a96c5550f3ce50aa19e8d1141c6c5d4176953ff" + "pnpmShrinkwrapHash": "94d69624f95398eba7cdf1e70cfc3b39facef814", + "preferredVersionsHash": "453ceee7444450f90086a91682f4c595da77c70a" } diff --git a/common/git-hooks/pre-commit b/common/git-hooks/pre-commit old mode 100644 new mode 100755 index 4575c83..ecda2ba --- a/common/git-hooks/pre-commit +++ b/common/git-hooks/pre-commit @@ -1,9 +1,9 @@ -#!/bin/sh -# Called by "git commit" with no arguments. The hook should -# exit with non-zero status after issuing an appropriate message if -# it wants to stop the commit. - -# Invoke the "rush prettier" custom command to reformat files whenever they -# are committed. The command is defined in common/config/rush/command-line.json -# and uses the "rush-prettier" autoinstaller. -node common/scripts/install-run-rush.js prettier || exit $? +#!/bin/sh +# Called by "git commit" with no arguments. The hook should +# exit with non-zero status after issuing an appropriate message if +# it wants to stop the commit. + +# Invoke the "rush prettier" custom command to reformat files whenever they +# are committed. The command is defined in common/config/rush/command-line.json +# and uses the "rush-prettier" autoinstaller. +node common/scripts/install-run-rush.js prettier || exit $? diff --git a/common/reviews/api/rush-stack-compiler-5.3.api.md b/common/reviews/api/rush-stack-compiler-5.3.api.md new file mode 100644 index 0000000..85de974 --- /dev/null +++ b/common/reviews/api/rush-stack-compiler-5.3.api.md @@ -0,0 +1,121 @@ +## API Report File for "@microsoft/rush-stack-compiler-5.3" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import * as ApiExtractor from '@microsoft/api-extractor'; +import { IPackageJson } from '@rushstack/node-core-library'; +import { ITerminalProvider } from '@rushstack/node-core-library'; +import { Terminal } from '@rushstack/node-core-library'; +import * as Typescript from 'typescript'; + +export { ApiExtractor } + +// @beta +export class ApiExtractorRunner extends RushStackCompilerBase { + constructor(extractorConfig: ApiExtractor.ExtractorConfig, extractorOptions: ApiExtractor.IExtractorInvokeOptions, rootPath: string, terminalProvider: ITerminalProvider); + constructor(options: IRushStackCompilerBaseOptions, extractorConfig: ApiExtractor.ExtractorConfig, extractorOptions: ApiExtractor.IExtractorInvokeOptions, rootPath: string, terminalProvider: ITerminalProvider); + // (undocumented) + invoke(): Promise; +} + +// @public (undocumented) +export interface ILintRunnerConfig extends IRushStackCompilerBaseOptions { + displayAsError?: boolean; +} + +// @public (undocumented) +export interface IRushStackCompilerBaseOptions { + // (undocumented) + fileError: WriteFileIssueFunction; + // (undocumented) + fileWarning: WriteFileIssueFunction; +} + +// @public (undocumented) +export interface ITslintRunnerConfig extends ILintRunnerConfig { +} + +// @beta (undocumented) +export interface ITypescriptCompilerOptions extends IRushStackCompilerBaseOptions { + customArgs?: string[]; +} + +// @beta (undocumented) +export class LintRunner extends RushStackCompilerBase { + constructor(taskOptions: ILintRunnerConfig, rootPath: string, terminalProvider: ITerminalProvider); + // (undocumented) + invoke(): Promise; +} + +// @beta (undocumented) +export abstract class RushStackCompilerBase { + constructor(taskOptions: TOptions, rootPath: string, terminalProvider: ITerminalProvider); + // (undocumented) + protected _fileError: WriteFileIssueFunction; + // (undocumented) + protected _fileWarning: WriteFileIssueFunction; + // (undocumented) + protected _standardBuildFolders: StandardBuildFolders; + // (undocumented) + protected _taskOptions: TOptions; + // (undocumented) + protected _terminal: Terminal; +} + +// @beta (undocumented) +export class StandardBuildFolders { + constructor(projectFolderPath: string); + // (undocumented) + get distFolderPath(): string; + // (undocumented) + get libFolderPath(): string; + // (undocumented) + get projectFolderPath(): string; + // (undocumented) + get srcFolderPath(): string; + // (undocumented) + get tempFolderPath(): string; +} + +// @beta (undocumented) +export class ToolPaths { + // (undocumented) + static get apiExtractorPackageJson(): IPackageJson; + // (undocumented) + static get apiExtractorPackagePath(): string; + // (undocumented) + static get eslintPackageJson(): IPackageJson; + // (undocumented) + static get eslintPackagePath(): string; + // (undocumented) + static get tslintPackageJson(): IPackageJson; + // (undocumented) + static get tslintPackagePath(): string; + // (undocumented) + static get typescriptPackageJson(): IPackageJson; + // (undocumented) + static get typescriptPackagePath(): string; +} + +// @beta (undocumented) +export class TslintRunner extends RushStackCompilerBase { + // (undocumented) + invoke(): Promise; +} + +export { Typescript } + +// @beta (undocumented) +export class TypescriptCompiler extends RushStackCompilerBase { + constructor(rootPath: string, terminalProvider: ITerminalProvider); + constructor(taskOptions: ITypescriptCompilerOptions, rootPath: string, terminalProvider: ITerminalProvider); + // (undocumented) + invoke(): Promise; +} + +// @public (undocumented) +export type WriteFileIssueFunction = (filePath: string, line: number, column: number, errorCode: string, message: string) => void; + +``` diff --git a/common/scripts/install-run-rush-pnpm.js b/common/scripts/install-run-rush-pnpm.js new file mode 100644 index 0000000..72a7bfd --- /dev/null +++ b/common/scripts/install-run-rush-pnpm.js @@ -0,0 +1,28 @@ +// THIS FILE WAS GENERATED BY A TOOL. ANY MANUAL MODIFICATIONS WILL GET OVERWRITTEN WHENEVER RUSH IS UPGRADED. +// +// This script is intended for usage in an automated build environment where the Rush command may not have +// been preinstalled, or may have an unpredictable version. This script will automatically install the version of Rush +// specified in the rush.json configuration file (if not already installed), and then pass a command-line to the +// rush-pnpm command. +// +// An example usage would be: +// +// node common/scripts/install-run-rush-pnpm.js pnpm-command +// +// For more information, see: https://rushjs.io/pages/maintainer/setup_new_repo/ + +/******/ (() => { // webpackBootstrap +/******/ "use strict"; +var __webpack_exports__ = {}; +/*!*****************************************************!*\ + !*** ./lib-esnext/scripts/install-run-rush-pnpm.js ***! + \*****************************************************/ + +// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. +// See LICENSE in the project root for license information. +require('./install-run-rush'); +//# sourceMappingURL=install-run-rush-pnpm.js.map +module.exports = __webpack_exports__; +/******/ })() +; +//# sourceMappingURL=install-run-rush-pnpm.js.map \ No newline at end of file diff --git a/common/scripts/install-run-rush.js b/common/scripts/install-run-rush.js index ff569fa..008e644 100644 --- a/common/scripts/install-run-rush.js +++ b/common/scripts/install-run-rush.js @@ -1,30 +1,3 @@ -"use strict"; -// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. -// See the @microsoft/rush package's LICENSE file for license information. -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); // THIS FILE WAS GENERATED BY A TOOL. ANY MANUAL MODIFICATIONS WILL GET OVERWRITTEN WHENEVER RUSH IS UPGRADED. // // This script is intended for usage in an automated build environment where the Rush command may not have @@ -35,38 +8,156 @@ Object.defineProperty(exports, "__esModule", { value: true }); // node common/scripts/install-run-rush.js install // // For more information, see: https://rushjs.io/pages/maintainer/setup_new_repo/ -const path = __importStar(require("path")); -const fs = __importStar(require("fs")); -const install_run_1 = require("./install-run"); + +/******/ (() => { // webpackBootstrap +/******/ "use strict"; +/******/ var __webpack_modules__ = ({ + +/***/ 657147: +/*!*********************!*\ + !*** external "fs" ***! + \*********************/ +/***/ ((module) => { + +module.exports = require("fs"); + +/***/ }), + +/***/ 371017: +/*!***********************!*\ + !*** external "path" ***! + \***********************/ +/***/ ((module) => { + +module.exports = require("path"); + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/compat get default export */ +/******/ (() => { +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = (module) => { +/******/ var getter = module && module.__esModule ? +/******/ () => (module['default']) : +/******/ () => (module); +/******/ __webpack_require__.d(getter, { a: getter }); +/******/ return getter; +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/define property getters */ +/******/ (() => { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = (exports, definition) => { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ (() => { +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +/******/ })(); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ (() => { +/******/ // define __esModule on exports +/******/ __webpack_require__.r = (exports) => { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ })(); +/******/ +/************************************************************************/ +var __webpack_exports__ = {}; +// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. +(() => { +/*!************************************************!*\ + !*** ./lib-esnext/scripts/install-run-rush.js ***! + \************************************************/ +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! path */ 371017); +/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! fs */ 657147); +/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_1__); +// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. +// See LICENSE in the project root for license information. +/* eslint-disable no-console */ + + +const { installAndRun, findRushJsonFolder, RUSH_JSON_FILENAME, runWithErrorAndStatusCode } = require('./install-run'); const PACKAGE_NAME = '@microsoft/rush'; const RUSH_PREVIEW_VERSION = 'RUSH_PREVIEW_VERSION'; +const INSTALL_RUN_RUSH_LOCKFILE_PATH_VARIABLE = 'INSTALL_RUN_RUSH_LOCKFILE_PATH'; function _getRushVersion(logger) { const rushPreviewVersion = process.env[RUSH_PREVIEW_VERSION]; if (rushPreviewVersion !== undefined) { logger.info(`Using Rush version from environment variable ${RUSH_PREVIEW_VERSION}=${rushPreviewVersion}`); return rushPreviewVersion; } - const rushJsonFolder = (0, install_run_1.findRushJsonFolder)(); - const rushJsonPath = path.join(rushJsonFolder, install_run_1.RUSH_JSON_FILENAME); + const rushJsonFolder = findRushJsonFolder(); + const rushJsonPath = path__WEBPACK_IMPORTED_MODULE_0__.join(rushJsonFolder, RUSH_JSON_FILENAME); try { - const rushJsonContents = fs.readFileSync(rushJsonPath, 'utf-8'); + const rushJsonContents = fs__WEBPACK_IMPORTED_MODULE_1__.readFileSync(rushJsonPath, 'utf-8'); // Use a regular expression to parse out the rushVersion value because rush.json supports comments, // but JSON.parse does not and we don't want to pull in more dependencies than we need to in this script. const rushJsonMatches = rushJsonContents.match(/\"rushVersion\"\s*\:\s*\"([0-9a-zA-Z.+\-]+)\"/); return rushJsonMatches[1]; } catch (e) { - throw new Error(`Unable to determine the required version of Rush from rush.json (${rushJsonFolder}). ` + - "The 'rushVersion' field is either not assigned in rush.json or was specified " + + throw new Error(`Unable to determine the required version of Rush from ${RUSH_JSON_FILENAME} (${rushJsonFolder}). ` + + `The 'rushVersion' field is either not assigned in ${RUSH_JSON_FILENAME} or was specified ` + 'using an unexpected syntax.'); } } +function _getBin(scriptName) { + switch (scriptName.toLowerCase()) { + case 'install-run-rush-pnpm.js': + return 'rush-pnpm'; + case 'install-run-rushx.js': + return 'rushx'; + default: + return 'rush'; + } +} function _run() { const [nodePath /* Ex: /bin/node */, scriptPath /* /repo/common/scripts/install-run-rush.js */, ...packageBinArgs /* [build, --to, myproject] */] = process.argv; // Detect if this script was directly invoked, or if the install-run-rushx script was invokved to select the // appropriate binary inside the rush package to run - const scriptName = path.basename(scriptPath); - const bin = scriptName.toLowerCase() === 'install-run-rushx.js' ? 'rushx' : 'rush'; + const scriptName = path__WEBPACK_IMPORTED_MODULE_0__.basename(scriptPath); + const bin = _getBin(scriptName); if (!nodePath || !scriptPath) { throw new Error('Unexpected exception: could not detect node path or script path'); } @@ -93,7 +184,10 @@ function _run() { } if (!commandFound) { console.log(`Usage: ${scriptName} [args...]`); - if (scriptName === 'install-run-rush.js') { + if (scriptName === 'install-run-rush-pnpm.js') { + console.log(`Example: ${scriptName} pnpm-command`); + } + else if (scriptName === 'install-run-rush.js') { console.log(`Example: ${scriptName} build --to myproject`); } else { @@ -101,11 +195,21 @@ function _run() { } process.exit(1); } - (0, install_run_1.runWithErrorAndStatusCode)(logger, () => { + runWithErrorAndStatusCode(logger, () => { const version = _getRushVersion(logger); - logger.info(`The rush.json configuration requests Rush version ${version}`); - return (0, install_run_1.installAndRun)(logger, PACKAGE_NAME, version, bin, packageBinArgs); + logger.info(`The ${RUSH_JSON_FILENAME} configuration requests Rush version ${version}`); + const lockFilePath = process.env[INSTALL_RUN_RUSH_LOCKFILE_PATH_VARIABLE]; + if (lockFilePath) { + logger.info(`Found ${INSTALL_RUN_RUSH_LOCKFILE_PATH_VARIABLE}="${lockFilePath}", installing with lockfile.`); + } + return installAndRun(logger, PACKAGE_NAME, version, bin, packageBinArgs, lockFilePath); }); } _run(); +//# sourceMappingURL=install-run-rush.js.map +})(); + +module.exports = __webpack_exports__; +/******/ })() +; //# sourceMappingURL=install-run-rush.js.map \ No newline at end of file diff --git a/common/scripts/install-run-rushx.js b/common/scripts/install-run-rushx.js index bf26eb5..0a0235f 100644 --- a/common/scripts/install-run-rushx.js +++ b/common/scripts/install-run-rushx.js @@ -1,7 +1,3 @@ -"use strict"; -// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. -// See the @microsoft/rush package's LICENSE file for license information. -Object.defineProperty(exports, "__esModule", { value: true }); // THIS FILE WAS GENERATED BY A TOOL. ANY MANUAL MODIFICATIONS WILL GET OVERWRITTEN WHENEVER RUSH IS UPGRADED. // // This script is intended for usage in an automated build environment where the Rush command may not have @@ -14,5 +10,19 @@ Object.defineProperty(exports, "__esModule", { value: true }); // node common/scripts/install-run-rushx.js custom-command // // For more information, see: https://rushjs.io/pages/maintainer/setup_new_repo/ -require("./install-run-rush"); + +/******/ (() => { // webpackBootstrap +/******/ "use strict"; +var __webpack_exports__ = {}; +/*!*************************************************!*\ + !*** ./lib-esnext/scripts/install-run-rushx.js ***! + \*************************************************/ + +// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. +// See LICENSE in the project root for license information. +require('./install-run-rush'); +//# sourceMappingURL=install-run-rushx.js.map +module.exports = __webpack_exports__; +/******/ })() +; //# sourceMappingURL=install-run-rushx.js.map \ No newline at end of file diff --git a/common/scripts/install-run.js b/common/scripts/install-run.js index 208b99c..08b606a 100644 --- a/common/scripts/install-run.js +++ b/common/scripts/install-run.js @@ -1,31 +1,3 @@ -"use strict"; -// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. -// See the @microsoft/rush package's LICENSE file for license information. -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.runWithErrorAndStatusCode = exports.installAndRun = exports.findRushJsonFolder = exports.getNpmPath = exports.RUSH_JSON_FILENAME = void 0; // THIS FILE WAS GENERATED BY A TOOL. ANY MANUAL MODIFICATIONS WILL GET OVERWRITTEN WHENEVER RUSH IS UPGRADED. // // This script is intended for usage in an automated build environment where a Node tool may not have @@ -36,12 +8,301 @@ exports.runWithErrorAndStatusCode = exports.installAndRun = exports.findRushJson // node common/scripts/install-run.js qrcode@1.2.2 qrcode https://rushjs.io // // For more information, see: https://rushjs.io/pages/maintainer/setup_new_repo/ -const childProcess = __importStar(require("child_process")); -const fs = __importStar(require("fs")); -const os = __importStar(require("os")); -const path = __importStar(require("path")); -exports.RUSH_JSON_FILENAME = 'rush.json'; + +/******/ (() => { // webpackBootstrap +/******/ "use strict"; +/******/ var __webpack_modules__ = ({ + +/***/ 679877: +/*!************************************************!*\ + !*** ./lib-esnext/utilities/npmrcUtilities.js ***! + \************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "isVariableSetInNpmrcFile": () => (/* binding */ isVariableSetInNpmrcFile), +/* harmony export */ "syncNpmrc": () => (/* binding */ syncNpmrc) +/* harmony export */ }); +/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! fs */ 657147); +/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! path */ 371017); +/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__); +// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. +// See LICENSE in the project root for license information. +// IMPORTANT - do not use any non-built-in libraries in this file + + +/** + * This function reads the content for given .npmrc file path, and also trims + * unusable lines from the .npmrc file. + * + * @returns + * The text of the the .npmrc. + */ +// create a global _combinedNpmrc for cache purpose +const _combinedNpmrcMap = new Map(); +function _trimNpmrcFile(options) { + const { sourceNpmrcPath, linesToPrepend, linesToAppend } = options; + const combinedNpmrcFromCache = _combinedNpmrcMap.get(sourceNpmrcPath); + if (combinedNpmrcFromCache !== undefined) { + return combinedNpmrcFromCache; + } + let npmrcFileLines = []; + if (linesToPrepend) { + npmrcFileLines.push(...linesToPrepend); + } + if (fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(sourceNpmrcPath)) { + npmrcFileLines.push(...fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync(sourceNpmrcPath).toString().split('\n')); + } + if (linesToAppend) { + npmrcFileLines.push(...linesToAppend); + } + npmrcFileLines = npmrcFileLines.map((line) => (line || '').trim()); + const resultLines = []; + // This finds environment variable tokens that look like "${VAR_NAME}" + const expansionRegExp = /\$\{([^\}]+)\}/g; + // Comment lines start with "#" or ";" + const commentRegExp = /^\s*[#;]/; + // Trim out lines that reference environment variables that aren't defined + for (let line of npmrcFileLines) { + let lineShouldBeTrimmed = false; + //remove spaces before or after key and value + line = line + .split('=') + .map((lineToTrim) => lineToTrim.trim()) + .join('='); + // Ignore comment lines + if (!commentRegExp.test(line)) { + const environmentVariables = line.match(expansionRegExp); + if (environmentVariables) { + for (const token of environmentVariables) { + // Remove the leading "${" and the trailing "}" from the token + const environmentVariableName = token.substring(2, token.length - 1); + // Is the environment variable defined? + if (!process.env[environmentVariableName]) { + // No, so trim this line + lineShouldBeTrimmed = true; + break; + } + } + } + } + if (lineShouldBeTrimmed) { + // Example output: + // "; MISSING ENVIRONMENT VARIABLE: //my-registry.com/npm/:_authToken=${MY_AUTH_TOKEN}" + resultLines.push('; MISSING ENVIRONMENT VARIABLE: ' + line); + } + else { + resultLines.push(line); + } + } + const combinedNpmrc = resultLines.join('\n'); + //save the cache + _combinedNpmrcMap.set(sourceNpmrcPath, combinedNpmrc); + return combinedNpmrc; +} +function _copyAndTrimNpmrcFile(options) { + const { logger, sourceNpmrcPath, targetNpmrcPath, linesToPrepend, linesToAppend } = options; + logger.info(`Transforming ${sourceNpmrcPath}`); // Verbose + logger.info(` --> "${targetNpmrcPath}"`); + const combinedNpmrc = _trimNpmrcFile({ + sourceNpmrcPath, + linesToPrepend, + linesToAppend + }); + fs__WEBPACK_IMPORTED_MODULE_0__.writeFileSync(targetNpmrcPath, combinedNpmrc); + return combinedNpmrc; +} +function syncNpmrc(options) { + const { sourceNpmrcFolder, targetNpmrcFolder, useNpmrcPublish, logger = { + // eslint-disable-next-line no-console + info: console.log, + // eslint-disable-next-line no-console + error: console.error + }, createIfMissing = false, linesToAppend, linesToPrepend } = options; + const sourceNpmrcPath = path__WEBPACK_IMPORTED_MODULE_1__.join(sourceNpmrcFolder, !useNpmrcPublish ? '.npmrc' : '.npmrc-publish'); + const targetNpmrcPath = path__WEBPACK_IMPORTED_MODULE_1__.join(targetNpmrcFolder, '.npmrc'); + try { + if (fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(sourceNpmrcPath) || createIfMissing) { + // Ensure the target folder exists + if (!fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(targetNpmrcFolder)) { + fs__WEBPACK_IMPORTED_MODULE_0__.mkdirSync(targetNpmrcFolder, { recursive: true }); + } + return _copyAndTrimNpmrcFile({ + sourceNpmrcPath, + targetNpmrcPath, + logger, + linesToAppend, + linesToPrepend + }); + } + else if (fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(targetNpmrcPath)) { + // If the source .npmrc doesn't exist and there is one in the target, delete the one in the target + logger.info(`Deleting ${targetNpmrcPath}`); // Verbose + fs__WEBPACK_IMPORTED_MODULE_0__.unlinkSync(targetNpmrcPath); + } + } + catch (e) { + throw new Error(`Error syncing .npmrc file: ${e}`); + } +} +function isVariableSetInNpmrcFile(sourceNpmrcFolder, variableKey) { + const sourceNpmrcPath = `${sourceNpmrcFolder}/.npmrc`; + //if .npmrc file does not exist, return false directly + if (!fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(sourceNpmrcPath)) { + return false; + } + const trimmedNpmrcFile = _trimNpmrcFile({ sourceNpmrcPath }); + const variableKeyRegExp = new RegExp(`^${variableKey}=`, 'm'); + return trimmedNpmrcFile.match(variableKeyRegExp) !== null; +} +//# sourceMappingURL=npmrcUtilities.js.map + +/***/ }), + +/***/ 532081: +/*!********************************!*\ + !*** external "child_process" ***! + \********************************/ +/***/ ((module) => { + +module.exports = require("child_process"); + +/***/ }), + +/***/ 657147: +/*!*********************!*\ + !*** external "fs" ***! + \*********************/ +/***/ ((module) => { + +module.exports = require("fs"); + +/***/ }), + +/***/ 822037: +/*!*********************!*\ + !*** external "os" ***! + \*********************/ +/***/ ((module) => { + +module.exports = require("os"); + +/***/ }), + +/***/ 371017: +/*!***********************!*\ + !*** external "path" ***! + \***********************/ +/***/ ((module) => { + +module.exports = require("path"); + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/compat get default export */ +/******/ (() => { +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = (module) => { +/******/ var getter = module && module.__esModule ? +/******/ () => (module['default']) : +/******/ () => (module); +/******/ __webpack_require__.d(getter, { a: getter }); +/******/ return getter; +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/define property getters */ +/******/ (() => { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = (exports, definition) => { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ (() => { +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +/******/ })(); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ (() => { +/******/ // define __esModule on exports +/******/ __webpack_require__.r = (exports) => { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ })(); +/******/ +/************************************************************************/ +var __webpack_exports__ = {}; +// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. +(() => { +/*!*******************************************!*\ + !*** ./lib-esnext/scripts/install-run.js ***! + \*******************************************/ +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "RUSH_JSON_FILENAME": () => (/* binding */ RUSH_JSON_FILENAME), +/* harmony export */ "findRushJsonFolder": () => (/* binding */ findRushJsonFolder), +/* harmony export */ "getNpmPath": () => (/* binding */ getNpmPath), +/* harmony export */ "installAndRun": () => (/* binding */ installAndRun), +/* harmony export */ "runWithErrorAndStatusCode": () => (/* binding */ runWithErrorAndStatusCode) +/* harmony export */ }); +/* harmony import */ var child_process__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! child_process */ 532081); +/* harmony import */ var child_process__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(child_process__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! fs */ 657147); +/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var os__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! os */ 822037); +/* harmony import */ var os__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(os__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! path */ 371017); +/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var _utilities_npmrcUtilities__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../utilities/npmrcUtilities */ 679877); +// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. +// See LICENSE in the project root for license information. +/* eslint-disable no-console */ + + + + + +const RUSH_JSON_FILENAME = 'rush.json'; const RUSH_TEMP_FOLDER_ENV_VARIABLE_NAME = 'RUSH_TEMP_FOLDER'; +const INSTALL_RUN_LOCKFILE_PATH_VARIABLE = 'INSTALL_RUN_LOCKFILE_PATH'; const INSTALLED_FLAG_FILENAME = 'installed.flag'; const NODE_MODULES_FOLDER_NAME = 'node_modules'; const PACKAGE_JSON_FILENAME = 'package.json'; @@ -70,82 +331,6 @@ function _parsePackageSpecifier(rawPackageSpecifier) { } return { name, version }; } -/** - * As a workaround, copyAndTrimNpmrcFile() copies the .npmrc file to the target folder, and also trims - * unusable lines from the .npmrc file. - * - * Why are we trimming the .npmrc lines? NPM allows environment variables to be specified in - * the .npmrc file to provide different authentication tokens for different registry. - * However, if the environment variable is undefined, it expands to an empty string, which - * produces a valid-looking mapping with an invalid URL that causes an error. Instead, - * we'd prefer to skip that line and continue looking in other places such as the user's - * home directory. - * - * IMPORTANT: THIS CODE SHOULD BE KEPT UP TO DATE WITH Utilities.copyAndTrimNpmrcFile() - */ -function _copyAndTrimNpmrcFile(logger, sourceNpmrcPath, targetNpmrcPath) { - logger.info(`Transforming ${sourceNpmrcPath}`); // Verbose - logger.info(` --> "${targetNpmrcPath}"`); - let npmrcFileLines = fs.readFileSync(sourceNpmrcPath).toString().split('\n'); - npmrcFileLines = npmrcFileLines.map((line) => (line || '').trim()); - const resultLines = []; - // This finds environment variable tokens that look like "${VAR_NAME}" - const expansionRegExp = /\$\{([^\}]+)\}/g; - // Comment lines start with "#" or ";" - const commentRegExp = /^\s*[#;]/; - // Trim out lines that reference environment variables that aren't defined - for (const line of npmrcFileLines) { - let lineShouldBeTrimmed = false; - // Ignore comment lines - if (!commentRegExp.test(line)) { - const environmentVariables = line.match(expansionRegExp); - if (environmentVariables) { - for (const token of environmentVariables) { - // Remove the leading "${" and the trailing "}" from the token - const environmentVariableName = token.substring(2, token.length - 1); - // Is the environment variable defined? - if (!process.env[environmentVariableName]) { - // No, so trim this line - lineShouldBeTrimmed = true; - break; - } - } - } - } - if (lineShouldBeTrimmed) { - // Example output: - // "; MISSING ENVIRONMENT VARIABLE: //my-registry.com/npm/:_authToken=${MY_AUTH_TOKEN}" - resultLines.push('; MISSING ENVIRONMENT VARIABLE: ' + line); - } - else { - resultLines.push(line); - } - } - fs.writeFileSync(targetNpmrcPath, resultLines.join(os.EOL)); -} -/** - * syncNpmrc() copies the .npmrc file to the target folder, and also trims unusable lines from the .npmrc file. - * If the source .npmrc file not exist, then syncNpmrc() will delete an .npmrc that is found in the target folder. - * - * IMPORTANT: THIS CODE SHOULD BE KEPT UP TO DATE WITH Utilities._syncNpmrc() - */ -function _syncNpmrc(logger, sourceNpmrcFolder, targetNpmrcFolder, useNpmrcPublish) { - const sourceNpmrcPath = path.join(sourceNpmrcFolder, !useNpmrcPublish ? '.npmrc' : '.npmrc-publish'); - const targetNpmrcPath = path.join(targetNpmrcFolder, '.npmrc'); - try { - if (fs.existsSync(sourceNpmrcPath)) { - _copyAndTrimNpmrcFile(logger, sourceNpmrcPath, targetNpmrcPath); - } - else if (fs.existsSync(targetNpmrcPath)) { - // If the source .npmrc doesn't exist and there is one in the target, delete the one in the target - logger.info(`Deleting ${targetNpmrcPath}`); // Verbose - fs.unlinkSync(targetNpmrcPath); - } - } - catch (e) { - throw new Error(`Error syncing .npmrc file: ${e}`); - } -} let _npmPath = undefined; /** * Get the absolute path to the npm executable @@ -153,35 +338,34 @@ let _npmPath = undefined; function getNpmPath() { if (!_npmPath) { try { - if (os.platform() === 'win32') { + if (os__WEBPACK_IMPORTED_MODULE_2__.platform() === 'win32') { // We're on Windows - const whereOutput = childProcess.execSync('where npm', { stdio: [] }).toString(); - const lines = whereOutput.split(os.EOL).filter((line) => !!line); + const whereOutput = child_process__WEBPACK_IMPORTED_MODULE_0__.execSync('where npm', { stdio: [] }).toString(); + const lines = whereOutput.split(os__WEBPACK_IMPORTED_MODULE_2__.EOL).filter((line) => !!line); // take the last result, we are looking for a .cmd command // see https://github.com/microsoft/rushstack/issues/759 _npmPath = lines[lines.length - 1]; } else { // We aren't on Windows - assume we're on *NIX or Darwin - _npmPath = childProcess.execSync('command -v npm', { stdio: [] }).toString(); + _npmPath = child_process__WEBPACK_IMPORTED_MODULE_0__.execSync('command -v npm', { stdio: [] }).toString(); } } catch (e) { throw new Error(`Unable to determine the path to the NPM tool: ${e}`); } _npmPath = _npmPath.trim(); - if (!fs.existsSync(_npmPath)) { + if (!fs__WEBPACK_IMPORTED_MODULE_1__.existsSync(_npmPath)) { throw new Error('The NPM executable does not exist'); } } return _npmPath; } -exports.getNpmPath = getNpmPath; function _ensureFolder(folderPath) { - if (!fs.existsSync(folderPath)) { - const parentDir = path.dirname(folderPath); + if (!fs__WEBPACK_IMPORTED_MODULE_1__.existsSync(folderPath)) { + const parentDir = path__WEBPACK_IMPORTED_MODULE_3__.dirname(folderPath); _ensureFolder(parentDir); - fs.mkdirSync(folderPath); + fs__WEBPACK_IMPORTED_MODULE_1__.mkdirSync(folderPath); } } /** @@ -195,14 +379,14 @@ function _ensureAndJoinPath(baseFolder, ...pathSegments) { try { for (let pathSegment of pathSegments) { pathSegment = pathSegment.replace(/[\\\/]/g, '+'); - joinedPath = path.join(joinedPath, pathSegment); - if (!fs.existsSync(joinedPath)) { - fs.mkdirSync(joinedPath); + joinedPath = path__WEBPACK_IMPORTED_MODULE_3__.join(joinedPath, pathSegment); + if (!fs__WEBPACK_IMPORTED_MODULE_1__.existsSync(joinedPath)) { + fs__WEBPACK_IMPORTED_MODULE_1__.mkdirSync(joinedPath); } } } catch (e) { - throw new Error(`Error building local installation folder (${path.join(baseFolder, ...pathSegments)}): ${e}`); + throw new Error(`Error building local installation folder (${path__WEBPACK_IMPORTED_MODULE_3__.join(baseFolder, ...pathSegments)}): ${e}`); } return joinedPath; } @@ -216,6 +400,23 @@ function _getRushTempFolder(rushCommonFolder) { return _ensureAndJoinPath(rushCommonFolder, 'temp'); } } +/** + * Compare version strings according to semantic versioning. + * Returns a positive integer if "a" is a later version than "b", + * a negative integer if "b" is later than "a", + * and 0 otherwise. + */ +function _compareVersionStrings(a, b) { + const aParts = a.split(/[.-]/); + const bParts = b.split(/[.-]/); + const numberOfParts = Math.max(aParts.length, bParts.length); + for (let i = 0; i < numberOfParts; i++) { + if (aParts[i] !== bParts[i]) { + return (Number(aParts[i]) || 0) - (Number(bParts[i]) || 0); + } + } + return 0; +} /** * Resolve a package specifier to a static version */ @@ -232,16 +433,31 @@ function _resolvePackageVersion(logger, rushCommonFolder, { name, version }) { // version resolves to try { const rushTempFolder = _getRushTempFolder(rushCommonFolder); - const sourceNpmrcFolder = path.join(rushCommonFolder, 'config', 'rush'); - _syncNpmrc(logger, sourceNpmrcFolder, rushTempFolder); + const sourceNpmrcFolder = path__WEBPACK_IMPORTED_MODULE_3__.join(rushCommonFolder, 'config', 'rush'); + (0,_utilities_npmrcUtilities__WEBPACK_IMPORTED_MODULE_4__.syncNpmrc)({ + sourceNpmrcFolder, + targetNpmrcFolder: rushTempFolder, + logger + }); const npmPath = getNpmPath(); // This returns something that looks like: - // @microsoft/rush@3.0.0 '3.0.0' - // @microsoft/rush@3.0.1 '3.0.1' - // ... - // @microsoft/rush@3.0.20 '3.0.20' - // - const npmVersionSpawnResult = childProcess.spawnSync(npmPath, ['view', `${name}@${version}`, 'version', '--no-update-notifier'], { + // ``` + // [ + // "3.0.0", + // "3.0.1", + // ... + // "3.0.20" + // ] + // ``` + // + // if multiple versions match the selector, or + // + // ``` + // "3.0.0" + // ``` + // + // if only a single version matches. + const npmVersionSpawnResult = child_process__WEBPACK_IMPORTED_MODULE_0__.spawnSync(npmPath, ['view', `${name}@${version}`, 'version', '--no-update-notifier', '--json'], { cwd: rushTempFolder, stdio: [] }); @@ -249,16 +465,21 @@ function _resolvePackageVersion(logger, rushCommonFolder, { name, version }) { throw new Error(`"npm view" returned error code ${npmVersionSpawnResult.status}`); } const npmViewVersionOutput = npmVersionSpawnResult.stdout.toString(); - const versionLines = npmViewVersionOutput.split('\n').filter((line) => !!line); - const latestVersion = versionLines[versionLines.length - 1]; + const parsedVersionOutput = JSON.parse(npmViewVersionOutput); + const versions = Array.isArray(parsedVersionOutput) + ? parsedVersionOutput + : [parsedVersionOutput]; + let latestVersion = versions[0]; + for (let i = 1; i < versions.length; i++) { + const latestVersionCandidate = versions[i]; + if (_compareVersionStrings(latestVersionCandidate, latestVersion) > 0) { + latestVersion = latestVersionCandidate; + } + } if (!latestVersion) { throw new Error('No versions found for the specified version range.'); } - const versionMatches = latestVersion.match(/^.+\s\'(.+)\'$/); - if (!versionMatches) { - throw new Error(`Invalid npm output ${latestVersion}`); - } - return versionMatches[1]; + return latestVersion; } catch (e) { throw new Error(`Unable to resolve version ${version} of package ${name}: ${e}`); @@ -274,58 +495,72 @@ function findRushJsonFolder() { let basePath = __dirname; let tempPath = __dirname; do { - const testRushJsonPath = path.join(basePath, exports.RUSH_JSON_FILENAME); - if (fs.existsSync(testRushJsonPath)) { + const testRushJsonPath = path__WEBPACK_IMPORTED_MODULE_3__.join(basePath, RUSH_JSON_FILENAME); + if (fs__WEBPACK_IMPORTED_MODULE_1__.existsSync(testRushJsonPath)) { _rushJsonFolder = basePath; break; } else { basePath = tempPath; } - } while (basePath !== (tempPath = path.dirname(basePath))); // Exit the loop when we hit the disk root + } while (basePath !== (tempPath = path__WEBPACK_IMPORTED_MODULE_3__.dirname(basePath))); // Exit the loop when we hit the disk root if (!_rushJsonFolder) { - throw new Error('Unable to find rush.json.'); + throw new Error(`Unable to find ${RUSH_JSON_FILENAME}.`); } } return _rushJsonFolder; } -exports.findRushJsonFolder = findRushJsonFolder; /** * Detects if the package in the specified directory is installed */ function _isPackageAlreadyInstalled(packageInstallFolder) { try { - const flagFilePath = path.join(packageInstallFolder, INSTALLED_FLAG_FILENAME); - if (!fs.existsSync(flagFilePath)) { + const flagFilePath = path__WEBPACK_IMPORTED_MODULE_3__.join(packageInstallFolder, INSTALLED_FLAG_FILENAME); + if (!fs__WEBPACK_IMPORTED_MODULE_1__.existsSync(flagFilePath)) { return false; } - const fileContents = fs.readFileSync(flagFilePath).toString(); + const fileContents = fs__WEBPACK_IMPORTED_MODULE_1__.readFileSync(flagFilePath).toString(); return fileContents.trim() === process.version; } catch (e) { return false; } } +/** + * Delete a file. Fail silently if it does not exist. + */ +function _deleteFile(file) { + try { + fs__WEBPACK_IMPORTED_MODULE_1__.unlinkSync(file); + } + catch (err) { + if (err.code !== 'ENOENT' && err.code !== 'ENOTDIR') { + throw err; + } + } +} /** * Removes the following files and directories under the specified folder path: * - installed.flag * - * - node_modules */ -function _cleanInstallFolder(rushTempFolder, packageInstallFolder) { +function _cleanInstallFolder(rushTempFolder, packageInstallFolder, lockFilePath) { try { - const flagFile = path.resolve(packageInstallFolder, INSTALLED_FLAG_FILENAME); - if (fs.existsSync(flagFile)) { - fs.unlinkSync(flagFile); + const flagFile = path__WEBPACK_IMPORTED_MODULE_3__.resolve(packageInstallFolder, INSTALLED_FLAG_FILENAME); + _deleteFile(flagFile); + const packageLockFile = path__WEBPACK_IMPORTED_MODULE_3__.resolve(packageInstallFolder, 'package-lock.json'); + if (lockFilePath) { + fs__WEBPACK_IMPORTED_MODULE_1__.copyFileSync(lockFilePath, packageLockFile); } - const packageLockFile = path.resolve(packageInstallFolder, 'package-lock.json'); - if (fs.existsSync(packageLockFile)) { - fs.unlinkSync(packageLockFile); - } - const nodeModulesFolder = path.resolve(packageInstallFolder, NODE_MODULES_FOLDER_NAME); - if (fs.existsSync(nodeModulesFolder)) { - const rushRecyclerFolder = _ensureAndJoinPath(rushTempFolder, 'rush-recycler'); - fs.renameSync(nodeModulesFolder, path.join(rushRecyclerFolder, `install-run-${Date.now().toString()}`)); + else { + // Not running `npm ci`, so need to cleanup + _deleteFile(packageLockFile); + const nodeModulesFolder = path__WEBPACK_IMPORTED_MODULE_3__.resolve(packageInstallFolder, NODE_MODULES_FOLDER_NAME); + if (fs__WEBPACK_IMPORTED_MODULE_1__.existsSync(nodeModulesFolder)) { + const rushRecyclerFolder = _ensureAndJoinPath(rushTempFolder, 'rush-recycler'); + fs__WEBPACK_IMPORTED_MODULE_1__.renameSync(nodeModulesFolder, path__WEBPACK_IMPORTED_MODULE_3__.join(rushRecyclerFolder, `install-run-${Date.now().toString()}`)); + } } } catch (e) { @@ -344,8 +579,8 @@ function _createPackageJson(packageInstallFolder, name, version) { repository: "DON'T WARN", license: 'MIT' }; - const packageJsonPath = path.join(packageInstallFolder, PACKAGE_JSON_FILENAME); - fs.writeFileSync(packageJsonPath, JSON.stringify(packageJsonContents, undefined, 2)); + const packageJsonPath = path__WEBPACK_IMPORTED_MODULE_3__.join(packageInstallFolder, PACKAGE_JSON_FILENAME); + fs__WEBPACK_IMPORTED_MODULE_1__.writeFileSync(packageJsonPath, JSON.stringify(packageJsonContents, undefined, 2)); } catch (e) { throw new Error(`Unable to create package.json: ${e}`); @@ -354,17 +589,17 @@ function _createPackageJson(packageInstallFolder, name, version) { /** * Run "npm install" in the package install folder. */ -function _installPackage(logger, packageInstallFolder, name, version) { +function _installPackage(logger, packageInstallFolder, name, version, command) { try { logger.info(`Installing ${name}...`); const npmPath = getNpmPath(); - const result = childProcess.spawnSync(npmPath, ['install'], { + const result = child_process__WEBPACK_IMPORTED_MODULE_0__.spawnSync(npmPath, [command], { stdio: 'inherit', cwd: packageInstallFolder, env: process.env }); if (result.status !== 0) { - throw new Error('"npm install" encountered an error'); + throw new Error(`"npm ${command}" encountered an error`); } logger.info(`Successfully installed ${name}@${version}`); } @@ -376,41 +611,46 @@ function _installPackage(logger, packageInstallFolder, name, version) { * Get the ".bin" path for the package. */ function _getBinPath(packageInstallFolder, binName) { - const binFolderPath = path.resolve(packageInstallFolder, NODE_MODULES_FOLDER_NAME, '.bin'); - const resolvedBinName = os.platform() === 'win32' ? `${binName}.cmd` : binName; - return path.resolve(binFolderPath, resolvedBinName); + const binFolderPath = path__WEBPACK_IMPORTED_MODULE_3__.resolve(packageInstallFolder, NODE_MODULES_FOLDER_NAME, '.bin'); + const resolvedBinName = os__WEBPACK_IMPORTED_MODULE_2__.platform() === 'win32' ? `${binName}.cmd` : binName; + return path__WEBPACK_IMPORTED_MODULE_3__.resolve(binFolderPath, resolvedBinName); } /** * Write a flag file to the package's install directory, signifying that the install was successful. */ function _writeFlagFile(packageInstallFolder) { try { - const flagFilePath = path.join(packageInstallFolder, INSTALLED_FLAG_FILENAME); - fs.writeFileSync(flagFilePath, process.version); + const flagFilePath = path__WEBPACK_IMPORTED_MODULE_3__.join(packageInstallFolder, INSTALLED_FLAG_FILENAME); + fs__WEBPACK_IMPORTED_MODULE_1__.writeFileSync(flagFilePath, process.version); } catch (e) { throw new Error(`Unable to create installed.flag file in ${packageInstallFolder}`); } } -function installAndRun(logger, packageName, packageVersion, packageBinName, packageBinArgs) { +function installAndRun(logger, packageName, packageVersion, packageBinName, packageBinArgs, lockFilePath = process.env[INSTALL_RUN_LOCKFILE_PATH_VARIABLE]) { const rushJsonFolder = findRushJsonFolder(); - const rushCommonFolder = path.join(rushJsonFolder, 'common'); + const rushCommonFolder = path__WEBPACK_IMPORTED_MODULE_3__.join(rushJsonFolder, 'common'); const rushTempFolder = _getRushTempFolder(rushCommonFolder); const packageInstallFolder = _ensureAndJoinPath(rushTempFolder, 'install-run', `${packageName}@${packageVersion}`); if (!_isPackageAlreadyInstalled(packageInstallFolder)) { // The package isn't already installed - _cleanInstallFolder(rushTempFolder, packageInstallFolder); - const sourceNpmrcFolder = path.join(rushCommonFolder, 'config', 'rush'); - _syncNpmrc(logger, sourceNpmrcFolder, packageInstallFolder); + _cleanInstallFolder(rushTempFolder, packageInstallFolder, lockFilePath); + const sourceNpmrcFolder = path__WEBPACK_IMPORTED_MODULE_3__.join(rushCommonFolder, 'config', 'rush'); + (0,_utilities_npmrcUtilities__WEBPACK_IMPORTED_MODULE_4__.syncNpmrc)({ + sourceNpmrcFolder, + targetNpmrcFolder: packageInstallFolder, + logger + }); _createPackageJson(packageInstallFolder, packageName, packageVersion); - _installPackage(logger, packageInstallFolder, packageName, packageVersion); + const command = lockFilePath ? 'ci' : 'install'; + _installPackage(logger, packageInstallFolder, packageName, packageVersion, command); _writeFlagFile(packageInstallFolder); } const statusMessage = `Invoking "${packageBinName} ${packageBinArgs.join(' ')}"`; const statusMessageLine = new Array(statusMessage.length + 1).join('-'); - logger.info(os.EOL + statusMessage + os.EOL + statusMessageLine + os.EOL); + logger.info('\n' + statusMessage + '\n' + statusMessageLine + '\n'); const binPath = _getBinPath(packageInstallFolder, packageBinName); - const binFolderPath = path.resolve(packageInstallFolder, NODE_MODULES_FOLDER_NAME, '.bin'); + const binFolderPath = path__WEBPACK_IMPORTED_MODULE_3__.resolve(packageInstallFolder, NODE_MODULES_FOLDER_NAME, '.bin'); // Windows environment variables are case-insensitive. Instead of using SpawnSyncOptions.env, we need to // assign via the process.env proxy to ensure that we append to the right PATH key. const originalEnvPath = process.env.PATH || ''; @@ -418,10 +658,10 @@ function installAndRun(logger, packageName, packageVersion, packageBinName, pack try { // Node.js on Windows can not spawn a file when the path has a space on it // unless the path gets wrapped in a cmd friendly way and shell mode is used - const shouldUseShell = binPath.includes(' ') && os.platform() === 'win32'; + const shouldUseShell = binPath.includes(' ') && os__WEBPACK_IMPORTED_MODULE_2__.platform() === 'win32'; const platformBinPath = shouldUseShell ? `"${binPath}"` : binPath; - process.env.PATH = [binFolderPath, originalEnvPath].join(path.delimiter); - result = childProcess.spawnSync(platformBinPath, packageBinArgs, { + process.env.PATH = [binFolderPath, originalEnvPath].join(path__WEBPACK_IMPORTED_MODULE_3__.delimiter); + result = child_process__WEBPACK_IMPORTED_MODULE_0__.spawnSync(platformBinPath, packageBinArgs, { stdio: 'inherit', windowsVerbatimArguments: false, shell: shouldUseShell, @@ -439,7 +679,6 @@ function installAndRun(logger, packageName, packageVersion, packageBinName, pack throw result.error || new Error('An unknown error occurred.'); } } -exports.installAndRun = installAndRun; function runWithErrorAndStatusCode(logger, fn) { process.exitCode = 1; try { @@ -447,16 +686,15 @@ function runWithErrorAndStatusCode(logger, fn) { process.exitCode = exitCode; } catch (e) { - logger.error(os.EOL + os.EOL + e.toString() + os.EOL + os.EOL); + logger.error('\n\n' + e.toString() + '\n\n'); } } -exports.runWithErrorAndStatusCode = runWithErrorAndStatusCode; function _run() { const [nodePath /* Ex: /bin/node */, scriptPath /* /repo/common/scripts/install-run-rush.js */, rawPackageSpecifier /* qrcode@^1.2.0 */, packageBinName /* qrcode */, ...packageBinArgs /* [-f, myproject/lib] */] = process.argv; if (!nodePath) { throw new Error('Unexpected exception: could not detect node path'); } - if (path.basename(scriptPath).toLowerCase() !== 'install-run.js') { + if (path__WEBPACK_IMPORTED_MODULE_3__.basename(scriptPath).toLowerCase() !== 'install-run.js') { // If install-run.js wasn't directly invoked, don't execute the rest of this function. Return control // to the script that (presumably) imported this file return; @@ -480,4 +718,10 @@ function _run() { }); } _run(); +//# sourceMappingURL=install-run.js.map +})(); + +module.exports = __webpack_exports__; +/******/ })() +; //# sourceMappingURL=install-run.js.map \ No newline at end of file diff --git a/rush.json b/rush.json index b02bae8..eee47e0 100644 --- a/rush.json +++ b/rush.json @@ -16,7 +16,7 @@ * path segment in the "$schema" field for all your Rush config files. This will ensure * correct error-underlining and tab-completion for editors such as VS Code. */ - "rushVersion": "5.76.1", + "rushVersion": "5.118.4", /** * The next field selects which package manager should be installed and determines its version. @@ -124,7 +124,7 @@ * LTS schedule: https://nodejs.org/en/about/releases/ * LTS versions: https://nodejs.org/en/download/releases/ */ - "nodeSupportedVersionRange": ">=14.15.0 <15.0.0 || >=16.20.2 < 17.0.0", + "nodeSupportedVersionRange": ">=18.18.2 < 19.0.0", /** * Odd-numbered major versions of Node.js are experimental. Even-numbered releases @@ -327,37 +327,6 @@ "postRushBuild": [] }, - /** - * Installation variants allow you to maintain a parallel set of configuration files that can be - * used to build the entire monorepo with an alternate set of dependencies. For example, suppose - * you upgrade all your projects to use a new release of an important framework, but during a transition period - * you intend to maintain compatibility with the old release. In this situation, you probably want your - * CI validation to build the entire repo twice: once with the old release, and once with the new release. - * - * Rush "installation variants" correspond to sets of config files located under this folder: - * - * common/config/rush/variants/ - * - * The variant folder can contain an alternate common-versions.json file. Its "preferredVersions" field can be used - * to select older versions of dependencies (within a loose SemVer range specified in your package.json files). - * To install a variant, run "rush install --variant ". - * - * For more details and instructions, see this article: https://rushjs.io/pages/advanced/installation_variants/ - */ - "variants": [ - // { - // /** - // * The folder name for this variant. - // */ - // "variantName": "old-sdk", - // - // /** - // * An informative description - // */ - // "description": "Build this repo using the previous release of the SDK" - // } - ], - /** * Rush can collect anonymous telemetry about everyday developer activity such as * success/failure of installs, builds, and other operations. You can use this to identify @@ -601,6 +570,12 @@ "reviewCategory": "tests", "shouldPublish": false }, + { + "packageName": "rush-stack-compiler-5.3-library-test", + "projectFolder": "build-tests/rush-stack-compiler-5.3-library-test", + "reviewCategory": "tests", + "shouldPublish": false + }, { "packageName": "web-library-build-test", @@ -778,6 +753,12 @@ "decoupledLocalDependencies": ["@microsoft/rush-stack-compiler-4.7"], "shouldPublish": true }, + { + "packageName": "@microsoft/rush-stack-compiler-5.3", + "projectFolder": "stack/rush-stack-compiler-5.3", + "reviewCategory": "libraries", + "shouldPublish": true + }, { "packageName": "@microsoft/rush-stack-compiler-shared", "projectFolder": "stack/rush-stack-compiler-shared", diff --git a/stack/rush-stack-compiler-5.3/.eslintrc.js b/stack/rush-stack-compiler-5.3/.eslintrc.js new file mode 100644 index 0000000..4c93479 --- /dev/null +++ b/stack/rush-stack-compiler-5.3/.eslintrc.js @@ -0,0 +1,10 @@ +// This is a workaround for https://github.com/eslint/eslint/issues/3458 +require('@rushstack/eslint-config/patch/modern-module-resolution'); + +module.exports = { + extends: [ + '@rushstack/eslint-config/profile/node-trusted-tool', + '@rushstack/eslint-config/mixins/friendly-locals' + ], + parserOptions: { tsconfigRootDir: __dirname } +}; diff --git a/stack/rush-stack-compiler-5.3/.gitignore b/stack/rush-stack-compiler-5.3/.gitignore new file mode 100644 index 0000000..dbc8690 --- /dev/null +++ b/stack/rush-stack-compiler-5.3/.gitignore @@ -0,0 +1 @@ +/src \ No newline at end of file diff --git a/stack/rush-stack-compiler-5.3/.npmignore b/stack/rush-stack-compiler-5.3/.npmignore new file mode 100644 index 0000000..ad6bcd9 --- /dev/null +++ b/stack/rush-stack-compiler-5.3/.npmignore @@ -0,0 +1,31 @@ +# THIS IS A STANDARD TEMPLATE FOR .npmignore FILES IN THIS REPO. + +# Ignore all files by default, to avoid accidentally publishing unintended files. +* + +# Use negative patterns to bring back the specific things we want to publish. +!/bin/** +!/lib/** +!/lib-*/** +!/dist/** +!ThirdPartyNotice.txt + +# Ignore certain patterns that should not get published. +/dist/*.stats.* +/lib/**/test/ +/lib-*/**/test/ +*.test.js + +# NOTE: These don't need to be specified, because NPM includes them automatically. +# +# package.json +# README (and its variants) +# CHANGELOG (and its variants) +# LICENSE / LICENCE + +#-------------------------------------------- +# DO NOT MODIFY THE TEMPLATE ABOVE THIS LINE +#-------------------------------------------- + +# (Add your project-specific overrides here) +!/includes/** diff --git a/stack/rush-stack-compiler-5.3/LICENSE b/stack/rush-stack-compiler-5.3/LICENSE new file mode 100644 index 0000000..7c29b93 --- /dev/null +++ b/stack/rush-stack-compiler-5.3/LICENSE @@ -0,0 +1,24 @@ +@microsoft/rush-stack + +Copyright (c) Microsoft Corporation. All rights reserved. + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/stack/rush-stack-compiler-5.3/README.md b/stack/rush-stack-compiler-5.3/README.md new file mode 100644 index 0000000..3e81502 --- /dev/null +++ b/stack/rush-stack-compiler-5.3/README.md @@ -0,0 +1,11 @@ +# @microsoft/rush-stack-compiler-5.3 + +This package is an NPM peer dependency that is used with +[@microsoft/rush-stack](https://www.npmjs.com/package/@microsoft/rush-stack) +to select a TypeScript compiler version. This variant selects TypeScript 5.3 + +It provides a supported set of versions for the following components: + +- the TypeScript compiler +- [eslint](https://eslint.org/) +- [API Extractor](https://api-extractor.com/) diff --git a/stack/rush-stack-compiler-5.3/bin/rush-api-extractor b/stack/rush-stack-compiler-5.3/bin/rush-api-extractor new file mode 100755 index 0000000..d6ece7d --- /dev/null +++ b/stack/rush-stack-compiler-5.3/bin/rush-api-extractor @@ -0,0 +1,2 @@ +#!/usr/bin/env node +require('@microsoft/api-extractor/bin/api-extractor'); diff --git a/stack/rush-stack-compiler-5.3/bin/rush-eslint b/stack/rush-stack-compiler-5.3/bin/rush-eslint new file mode 100755 index 0000000..0ecf803 --- /dev/null +++ b/stack/rush-stack-compiler-5.3/bin/rush-eslint @@ -0,0 +1,2 @@ +#!/usr/bin/env node +require('eslint/bin/eslint'); diff --git a/stack/rush-stack-compiler-5.3/bin/rush-tsc b/stack/rush-stack-compiler-5.3/bin/rush-tsc new file mode 100755 index 0000000..978b975 --- /dev/null +++ b/stack/rush-stack-compiler-5.3/bin/rush-tsc @@ -0,0 +1,2 @@ +#!/usr/bin/env node +require('typescript/bin/tsc'); diff --git a/stack/rush-stack-compiler-5.3/config/api-extractor.json b/stack/rush-stack-compiler-5.3/config/api-extractor.json new file mode 100644 index 0000000..dcfa9cf --- /dev/null +++ b/stack/rush-stack-compiler-5.3/config/api-extractor.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + + "mainEntryPointFilePath": "/lib/index.d.ts", + + "apiReport": { + "enabled": true, + "reportFolder": "../../../common/reviews/api" + }, + + "docModel": { + "enabled": true + }, + + "dtsRollup": { + "enabled": false + } +} diff --git a/stack/rush-stack-compiler-5.3/config/heft.json b/stack/rush-stack-compiler-5.3/config/heft.json new file mode 100644 index 0000000..8e199ba --- /dev/null +++ b/stack/rush-stack-compiler-5.3/config/heft.json @@ -0,0 +1,32 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/heft/heft.schema.json", + + "extends": "@rushstack/heft-node-rig/profiles/default/config/heft.json", + + "eventActions": [ + { + "actionKind": "deleteGlobs", + "heftEvent": "clean", + "actionId": "deleteSrc", + "globsToDelete": ["src"] + }, + + { + "actionKind": "copyFiles", + "heftEvent": "pre-compile", + "actionId": "copySrc", + "copyOperations": [ + { + "sourceFolder": "node_modules/@microsoft/rush-stack-compiler-shared/src", + "destinationFolders": ["src"], + "includeGlobs": ["*.ts", "*.js"] + }, + { + "sourceFolder": "node_modules/@microsoft/rush-stack-compiler-shared/src/v4", + "destinationFolders": ["src"], + "includeGlobs": ["*.ts", "*.js"] + } + ] + } + ] +} diff --git a/stack/rush-stack-compiler-5.3/config/rig.json b/stack/rush-stack-compiler-5.3/config/rig.json new file mode 100644 index 0000000..6ac88a9 --- /dev/null +++ b/stack/rush-stack-compiler-5.3/config/rig.json @@ -0,0 +1,7 @@ +{ + // The "rig.json" file directs tools to look for their config files in an external package. + // Documentation for this system: https://www.npmjs.com/package/@rushstack/rig-package + "$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json", + + "rigPackageName": "@rushstack/heft-node-rig" +} diff --git a/stack/rush-stack-compiler-5.3/config/typescript.json b/stack/rush-stack-compiler-5.3/config/typescript.json new file mode 100644 index 0000000..6e09afa --- /dev/null +++ b/stack/rush-stack-compiler-5.3/config/typescript.json @@ -0,0 +1,12 @@ +/** + * Configures the TypeScript plugin for Heft. This plugin also manages linting. + */ +{ + "$schema": "https://developer.microsoft.com/json-schemas/heft/typescript.schema.json", + + "extends": "@rushstack/heft-node-rig/profiles/default/config/typescript.json", + + "staticAssetsToCopy": { + "fileExtensions": [".d.ts", ".js"] + } +} diff --git a/stack/rush-stack-compiler-5.3/includes/tsconfig-base.json b/stack/rush-stack-compiler-5.3/includes/tsconfig-base.json new file mode 100644 index 0000000..6c52435 --- /dev/null +++ b/stack/rush-stack-compiler-5.3/includes/tsconfig-base.json @@ -0,0 +1,21 @@ +{ + "$schema": "http://json.schemastore.org/tsconfig", + + "compilerOptions": { + "outDir": "../../../../lib", + "rootDir": "../../../../src", + + "forceConsistentCasingInFileNames": true, + "jsx": "react", + "declaration": true, + "sourceMap": true, + "declarationMap": true, + "inlineSources": true, + "experimentalDecorators": true, + "strictNullChecks": true, + "noUnusedLocals": true, + "types": [] + }, + "include": ["../../../../src/**/*.ts", "../../../../src/**/*.tsx"], + "exclude": ["../../../../node_modules", "../../../../lib"] +} diff --git a/stack/rush-stack-compiler-5.3/includes/tsconfig-node.json b/stack/rush-stack-compiler-5.3/includes/tsconfig-node.json new file mode 100644 index 0000000..722f0b8 --- /dev/null +++ b/stack/rush-stack-compiler-5.3/includes/tsconfig-node.json @@ -0,0 +1,10 @@ +{ + "$schema": "http://json.schemastore.org/tsconfig", + + "extends": "./tsconfig-base.json", + "compilerOptions": { + "module": "commonjs", + "target": "es2017", + "lib": ["es2017"] + } +} diff --git a/stack/rush-stack-compiler-5.3/includes/tsconfig-web.json b/stack/rush-stack-compiler-5.3/includes/tsconfig-web.json new file mode 100644 index 0000000..5dd9e12 --- /dev/null +++ b/stack/rush-stack-compiler-5.3/includes/tsconfig-web.json @@ -0,0 +1,11 @@ +{ + "$schema": "http://json.schemastore.org/tsconfig", + + "extends": "./tsconfig-base.json", + "compilerOptions": { + "module": "esnext", + "moduleResolution": "node", + "target": "es5", + "lib": ["es5", "scripthost", "es2015.collection", "es2015.promise", "es2015.iterable", "dom"] + } +} diff --git a/stack/rush-stack-compiler-5.3/package.json b/stack/rush-stack-compiler-5.3/package.json new file mode 100644 index 0000000..7827c0a --- /dev/null +++ b/stack/rush-stack-compiler-5.3/package.json @@ -0,0 +1,38 @@ +{ + "name": "@microsoft/rush-stack-compiler-5.3", + "version": "0.1.0", + "description": "A plug-in for selecting the compiler used with the @microsoft/rush-stack toolchain. This version selects TypeScript 5.3.", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/microsoft/rushstack-legacy/tree/master/stack/rush-stack-compiler-5.3" + }, + "bin": { + "rush-api-extractor": "./bin/rush-api-extractor", + "rush-eslint": "./bin/rush-eslint", + "rush-tsc": "./bin/rush-tsc" + }, + "scripts": { + "build": "heft build --clean" + }, + "main": "lib/index.js", + "typings": "lib/index.d.ts", + "dependencies": { + "@microsoft/api-extractor": "~7.15.2", + "@rushstack/eslint-config": "~2.6.2", + "@rushstack/node-core-library": "~3.53.0", + "@types/node": "10.17.13", + "import-lazy": "~4.0.0", + "typescript": "~5.3.3" + }, + "devDependencies": { + "@microsoft/rush-stack-compiler-4.7": "workspace:*", + "@microsoft/rush-stack-compiler-shared": "workspace:*", + "@rushstack/eslint-config": "~2.6.2", + "@rushstack/heft": "0.48.0", + "@rushstack/heft-node-rig": "1.11.0" + }, + "peerDependencies": { + "eslint": "^8.57.0" + } +} diff --git a/stack/rush-stack-compiler-5.3/tsconfig.json b/stack/rush-stack-compiler-5.3/tsconfig.json new file mode 100644 index 0000000..bb3b5d1 --- /dev/null +++ b/stack/rush-stack-compiler-5.3/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "./node_modules/@microsoft/rush-stack-compiler-4.7/includes/tsconfig-node.json", + + "compilerOptions": { + "rootDir": "src", + "outDir": "lib" + } +}