├── .eslintignore ├── .gitignore ├── .prettierrc ├── .yarn ├── sdks │ ├── eslint │ │ ├── package.json │ │ ├── lib │ │ │ └── api.js │ │ └── bin │ │ │ └── eslint.js │ ├── integrations.yml │ ├── prettier │ │ ├── package.json │ │ └── index.js │ └── typescript │ │ ├── package.json │ │ ├── bin │ │ ├── tsc │ │ └── tsserver │ │ └── lib │ │ ├── tsc.js │ │ ├── typescript.js │ │ └── tsserver.js └── plugins │ └── @yarnpkg │ ├── plugin-typescript.cjs │ └── plugin-workspace-tools.cjs ├── .vscode ├── extensions.json └── settings.json ├── packages ├── docker-build │ ├── src │ │ ├── index.ts │ │ ├── utils │ │ │ ├── copyRcFile.ts │ │ │ ├── copyYarnRelease.ts │ │ │ ├── copyPlugins.ts │ │ │ ├── generateLockfile.ts │ │ │ ├── copyCacheMarkedFiles.ts │ │ │ ├── execUtils.ts │ │ │ ├── getDockerFilePath.ts │ │ │ ├── copyManifests.ts │ │ │ ├── copyAdditional.ts │ │ │ ├── packWorkspace.ts │ │ │ ├── getRequiredWorkspaces.ts │ │ │ └── copyProtocolFiles.ts │ │ └── commands │ │ │ └── build.ts │ ├── package.json │ └── README.md ├── changed │ ├── src │ │ ├── index.ts │ │ ├── utils │ │ │ ├── getWorkspaceDependents.ts │ │ │ ├── listChangedWorkspaces.ts │ │ │ └── getWorkspaceDependencies.ts │ │ └── commands │ │ │ ├── filter.ts │ │ │ ├── list.ts │ │ │ └── foreach.ts │ ├── package.json │ └── README.md └── tsconfig-references │ ├── README.md │ ├── package.json │ └── src │ └── index.ts ├── integration ├── jest.config.js ├── utils │ ├── TestWorkspace.ts │ └── TestProject.ts └── tsconfig-references │ └── __tests__ │ └── index.ts ├── .eslintrc ├── .yarnrc.yml ├── tsconfig.json ├── .releaserc.json ├── commitlint.config.js ├── README.md ├── constraints.pro ├── .github └── workflows │ └── build.yml ├── LICENSE └── package.json /.eslintignore: -------------------------------------------------------------------------------- 1 | /.yarn/ 2 | node_modules/ 3 | packages/*/bundles/ 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.yarn/unplugged 2 | /.yarn/build-state.yml 3 | /.yarn/cache 4 | bundles/ 5 | /.yarn/install-state.gz 6 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "tabWidth": 2, 3 | "useTabs": false, 4 | "singleQuote": true, 5 | "trailingComma": "all" 6 | } 7 | -------------------------------------------------------------------------------- /.yarn/sdks/eslint/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "eslint", 3 | "version": "7.8.1-pnpify", 4 | "main": "./lib/api.js", 5 | "type": "commonjs" 6 | } 7 | -------------------------------------------------------------------------------- /.yarn/sdks/integrations.yml: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by PnPify. 2 | # Manual changes will be lost! 3 | 4 | integrations: 5 | - vscode 6 | -------------------------------------------------------------------------------- /.yarn/sdks/prettier/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "prettier", 3 | "version": "2.1.1-pnpify", 4 | "main": "./index.js", 5 | "type": "commonjs" 6 | } 7 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "dbaeumer.vscode-eslint", 4 | "esbenp.prettier-vscode", 5 | "arcanis.vscode-zipfs" 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /.yarn/sdks/typescript/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "typescript", 3 | "version": "4.0.2-pnpify", 4 | "main": "./lib/typescript.js", 5 | "type": "commonjs" 6 | } 7 | -------------------------------------------------------------------------------- /packages/docker-build/src/index.ts: -------------------------------------------------------------------------------- 1 | import { Plugin } from '@yarnpkg/core'; 2 | 3 | import build from './commands/build'; 4 | 5 | const plugin: Plugin = { 6 | commands: [build], 7 | }; 8 | 9 | export default plugin; 10 | -------------------------------------------------------------------------------- /packages/changed/src/index.ts: -------------------------------------------------------------------------------- 1 | import { Plugin } from '@yarnpkg/core'; 2 | 3 | import list from './commands/list'; 4 | import foreach from './commands/foreach'; 5 | 6 | const plugin: Plugin = { 7 | commands: [list, foreach], 8 | }; 9 | 10 | export default plugin; 11 | -------------------------------------------------------------------------------- /integration/jest.config.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = { 4 | preset: 'ts-jest', 5 | testEnvironment: 'node', 6 | setupFilesAfterEnv: ['jest-extended'], 7 | globals: { 8 | 'ts-jest': { 9 | packageJson: 'package.json', 10 | }, 11 | }, 12 | }; 13 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "typescript.tsdk": ".yarn/sdks/typescript/lib", 3 | "eslint.nodePath": ".yarn/sdks", 4 | "prettier.prettierPath": ".yarn/sdks/prettier/index.js", 5 | "typescript.enablePromptUseWorkspaceTsdk": true, 6 | "search.exclude": { 7 | "**/.yarn": true, 8 | "**/.pnp.*": true 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/tsconfig-references/README.md: -------------------------------------------------------------------------------- 1 | # yarn-plugin-tsconfig-references 2 | 3 | Update `references` in `tsconfig.json` when adding or removing workspaces. 4 | 5 | ## Installation 6 | 7 | Install the latest plugin. 8 | 9 | ```sh 10 | yarn plugin import https://github.com/Dcard/yarn-plugins/releases/latest/download/plugin-tsconfig-references.js 11 | ``` 12 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "parser": "@typescript-eslint/parser", 4 | "plugins": ["@typescript-eslint", "jest"], 5 | "extends": [ 6 | "eslint:recommended", 7 | "plugin:@typescript-eslint/eslint-recommended", 8 | "plugin:@typescript-eslint/recommended", 9 | "plugin:prettier/recommended", 10 | "prettier/@typescript-eslint", 11 | "plugin:jest/recommended" 12 | ], 13 | "env": { 14 | "es6": true, 15 | "node": true 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /.yarnrc.yml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - path: .yarn/plugins/@yarnpkg/plugin-typescript.cjs 3 | spec: "@yarnpkg/plugin-typescript" 4 | - path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs 5 | spec: "@yarnpkg/plugin-workspace-tools" 6 | - path: .yarn/plugins/@yarnpkg/plugin-constraints.cjs 7 | spec: "@yarnpkg/plugin-constraints" 8 | - path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs 9 | spec: "@yarnpkg/plugin-interactive-tools" 10 | 11 | yarnPath: .yarn/releases/yarn-2.4.0.cjs 12 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "allowSyntheticDefaultImports": true, 4 | "alwaysStrict": true, 5 | "esModuleInterop": true, 6 | "module": "commonjs", 7 | "moduleResolution": "node", 8 | "preserveConstEnums": true, 9 | "strict": true, 10 | "suppressImplicitAnyIndexErrors": false, 11 | "target": "es2017", 12 | "forceConsistentCasingInFileNames": true, 13 | "skipLibCheck": true, 14 | "resolveJsonModule": true, 15 | "experimentalDecorators": true 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packages/changed/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@dcard/yarn-plugin-changed", 3 | "version": "0.0.1", 4 | "main": "src/index.ts", 5 | "scripts": { 6 | "build": "builder build plugin" 7 | }, 8 | "dependencies": { 9 | "clipanion": "^2.4.4" 10 | }, 11 | "devDependencies": { 12 | "@yarnpkg/builder": "^2.1.3", 13 | "@yarnpkg/cli": "^2.4.1", 14 | "@yarnpkg/core": "^2.4.0", 15 | "@yarnpkg/fslib": "^2.4.0", 16 | "@yarnpkg/plugin-essentials": "^2.4.0", 17 | "@yarnpkg/shell": "^2.4.1", 18 | "typescript": "^4.0.2" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/docker-build/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@dcard/yarn-plugin-docker-build", 3 | "version": "0.0.1", 4 | "main": "src/index.ts", 5 | "scripts": { 6 | "build": "builder build plugin" 7 | }, 8 | "dependencies": { 9 | "clipanion": "^2.4.4" 10 | }, 11 | "devDependencies": { 12 | "@yarnpkg/builder": "^2.1.3", 13 | "@yarnpkg/cli": "^2.4.1", 14 | "@yarnpkg/core": "^2.4.0", 15 | "@yarnpkg/fslib": "^2.4.0", 16 | "@yarnpkg/plugin-pack": "^2.2.3", 17 | "@yarnpkg/plugin-patch": "^2.1.2", 18 | "typescript": "^4.0.2" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /.releaserc.json: -------------------------------------------------------------------------------- 1 | { 2 | "branches": ["master"], 3 | "plugins": [ 4 | [ 5 | "@semantic-release/commit-analyzer", 6 | { 7 | "releaseRules": [ 8 | { 9 | "type": "chore", 10 | "release": "patch" 11 | } 12 | ] 13 | } 14 | ], 15 | "@semantic-release/release-notes-generator", 16 | [ 17 | "@semantic-release/github", 18 | { 19 | "assets": [ 20 | { 21 | "path": "packages/*/bundles/**/*.js" 22 | } 23 | ] 24 | } 25 | ] 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /packages/tsconfig-references/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@dcard/yarn-plugin-tsconfig-references", 3 | "version": "0.0.1", 4 | "main": "src/index.ts", 5 | "scripts": { 6 | "build": "builder build plugin" 7 | }, 8 | "dependencies": { 9 | "detect-indent": "^6.0.0" 10 | }, 11 | "devDependencies": { 12 | "@types/detect-indent": "6.0.0", 13 | "@yarnpkg/builder": "^2.1.3", 14 | "@yarnpkg/cli": "^2.4.1", 15 | "@yarnpkg/core": "^2.4.0", 16 | "@yarnpkg/fslib": "^2.4.0", 17 | "@yarnpkg/plugin-essentials": "^2.4.0", 18 | "typescript": "^4.0.2" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/docker-build/src/utils/copyRcFile.ts: -------------------------------------------------------------------------------- 1 | import { Project, Report } from '@yarnpkg/core'; 2 | import { PortablePath, ppath, xfs } from '@yarnpkg/fslib'; 3 | 4 | export default async function copyRcFile({ 5 | destination, 6 | project, 7 | report, 8 | }: { 9 | destination: PortablePath; 10 | project: Project; 11 | report: Report; 12 | }): Promise { 13 | const filename = project.configuration.get('rcFilename'); 14 | 15 | report.reportInfo(null, filename); 16 | await xfs.copyPromise( 17 | ppath.join(destination, filename), 18 | ppath.join(project.cwd, filename), 19 | { overwrite: true }, 20 | ); 21 | } 22 | -------------------------------------------------------------------------------- /commitlint.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | rules: { 3 | 'body-leading-blank': [2, 'always'], 4 | 'footer-leading-blank': [2, 'always'], 5 | 'header-max-length': [2, 'always', 72], 6 | 'scope-empty': [2, 'never'], 7 | 'type-case': [2, 'always', 'lower-case'], 8 | 'type-empty': [2, 'never'], 9 | 'type-enum': [ 10 | 2, 11 | 'always', 12 | [ 13 | 'build', 14 | 'chore', 15 | 'ci', 16 | 'docs', 17 | 'feat', 18 | 'fix', 19 | 'perf', 20 | 'refactor', 21 | 'revert', 22 | 'style', 23 | 'test', 24 | ], 25 | ], 26 | }, 27 | }; 28 | -------------------------------------------------------------------------------- /packages/changed/src/utils/getWorkspaceDependents.ts: -------------------------------------------------------------------------------- 1 | import { Workspace, structUtils } from '@yarnpkg/core'; 2 | import getWorkspaceDependencies from './getWorkspaceDependencies'; 3 | 4 | export default function getWorkspaceDependents( 5 | workspace: Workspace, 6 | ): readonly Workspace[] { 7 | const dependents = new Set(); 8 | 9 | for (const ws of workspace.project.workspaces) { 10 | const isDep = getWorkspaceDependencies(ws).some((dep) => 11 | structUtils.areLocatorsEqual(dep.locator, workspace.locator), 12 | ); 13 | 14 | if (isDep) { 15 | dependents.add(ws); 16 | } 17 | } 18 | 19 | return [...dependents]; 20 | } 21 | -------------------------------------------------------------------------------- /packages/docker-build/src/utils/copyYarnRelease.ts: -------------------------------------------------------------------------------- 1 | import { PortablePath, xfs, ppath } from '@yarnpkg/fslib'; 2 | import { Project, Report } from '@yarnpkg/core'; 3 | 4 | export default async function copyYarnRelease({ 5 | destination, 6 | project, 7 | report, 8 | }: { 9 | destination: PortablePath; 10 | project: Project; 11 | report: Report; 12 | }): Promise { 13 | const src = project.configuration.get('yarnPath'); 14 | const path = ppath.relative(project.cwd, src); 15 | const dest = ppath.join(destination, path); 16 | 17 | report.reportInfo(null, path); 18 | await xfs.copyPromise(dest, src, { 19 | overwrite: true, 20 | }); 21 | } 22 | -------------------------------------------------------------------------------- /packages/docker-build/src/utils/copyPlugins.ts: -------------------------------------------------------------------------------- 1 | import { PortablePath, xfs, toFilename, ppath } from '@yarnpkg/fslib'; 2 | import { Project, Report } from '@yarnpkg/core'; 3 | 4 | export default async function copyPlugins({ 5 | destination, 6 | project, 7 | report, 8 | }: { 9 | destination: PortablePath; 10 | project: Project; 11 | report: Report; 12 | }): Promise { 13 | const pluginDir = ppath.join(toFilename('.yarn'), toFilename('plugins')); 14 | 15 | report.reportInfo(null, pluginDir); 16 | await xfs.copyPromise( 17 | ppath.join(destination, pluginDir), 18 | ppath.join(project.cwd, pluginDir), 19 | { overwrite: true }, 20 | ); 21 | } 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # yarn-plugins 2 | 3 | [![GitHub release](https://img.shields.io/github/release/Dcard/yarn-plugins.svg)](https://github.com/Dcard/yarn-plugins/releases) ![Build](https://github.com/Dcard/yarn-plugins/workflows/Build/badge.svg) 4 | 5 | Yarn plugins for Yarn 2. 6 | 7 | ## Plugins 8 | 9 | - [yarn-plugin-changed](packages/changed) - List and run a command on changed workspaces and their dependents. 10 | - [yarn-plugin-docker-build](packages/docker-build) - Build a Docker image for a workspace. 11 | - [yarn-plugin-tsconfig-references](packages/tsconfig-references) - Update `references` in `tsconfig.json` when adding/removing workspaces. 12 | 13 | ## License 14 | 15 | MIT 16 | -------------------------------------------------------------------------------- /constraints.pro: -------------------------------------------------------------------------------- 1 | % https://yarnpkg.com/features/constraints#prevent-two-workspaces-from-depending-on-conflicting-versions-of-a-same-dependency 2 | gen_enforced_dependency(WorkspaceCwd, DependencyIdent, DependencyRange2, DependencyType) :- 3 | workspace_has_dependency(WorkspaceCwd, DependencyIdent, DependencyRange, DependencyType), 4 | workspace_has_dependency(OtherWorkspaceCwd, DependencyIdent, DependencyRange2, DependencyType2), 5 | DependencyRange \= DependencyRange2. 6 | 7 | % This rule will prevent all workspaces from depending on tslib 8 | gen_enforced_dependency(WorkspaceCwd, 'tslib', null, DependencyType) :- 9 | workspace_has_dependency(WorkspaceCwd, 'tslib', _, DependencyType). 10 | -------------------------------------------------------------------------------- /packages/docker-build/src/utils/generateLockfile.ts: -------------------------------------------------------------------------------- 1 | import { Project, Report } from '@yarnpkg/core'; 2 | import { PortablePath, toFilename, xfs, ppath } from '@yarnpkg/fslib'; 3 | 4 | export default async function generateLockfile({ 5 | destination, 6 | project, 7 | report, 8 | }: { 9 | destination: PortablePath; 10 | project: Project; 11 | report: Report; 12 | }): Promise { 13 | const filename = toFilename(project.configuration.get('lockfileFilename')); 14 | const dest = ppath.join(destination, filename); 15 | 16 | report.reportInfo(null, filename); 17 | await xfs.mkdirpPromise(ppath.dirname(dest)); 18 | await xfs.writeFilePromise(dest, project.generateLockfile()); 19 | } 20 | -------------------------------------------------------------------------------- /packages/docker-build/src/utils/copyCacheMarkedFiles.ts: -------------------------------------------------------------------------------- 1 | import { PortablePath, xfs, ppath } from '@yarnpkg/fslib'; 2 | import { Cache, Project, Report } from '@yarnpkg/core'; 3 | 4 | export default async function copyCacheMarkedFiles({ 5 | destination, 6 | project, 7 | cache, 8 | report, 9 | }: { 10 | destination: PortablePath; 11 | project: Project; 12 | cache: Cache; 13 | report: Report; 14 | }): Promise { 15 | for (const src of cache.markedFiles) { 16 | const path = ppath.relative(project.cwd, src); 17 | 18 | if (await xfs.existsPromise(src)) { 19 | report.reportInfo(null, path); 20 | await xfs.copyPromise(ppath.join(destination, path), src); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /.yarn/sdks/prettier/index.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const {existsSync} = require(`fs`); 4 | const {createRequire, createRequireFromPath} = require(`module`); 5 | const {resolve} = require(`path`); 6 | 7 | const relPnpApiPath = "../../../.pnp.js"; 8 | 9 | const absPnpApiPath = resolve(__dirname, relPnpApiPath); 10 | const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath); 11 | 12 | if (existsSync(absPnpApiPath)) { 13 | if (!process.versions.pnp) { 14 | // Setup the environment to be able to require prettier/index.js 15 | require(absPnpApiPath).setup(); 16 | } 17 | } 18 | 19 | // Defer to the real prettier/index.js your application uses 20 | module.exports = absRequire(`prettier/index.js`); 21 | -------------------------------------------------------------------------------- /.yarn/sdks/eslint/lib/api.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const {existsSync} = require(`fs`); 4 | const {createRequire, createRequireFromPath} = require(`module`); 5 | const {resolve} = require(`path`); 6 | 7 | const relPnpApiPath = "../../../../.pnp.js"; 8 | 9 | const absPnpApiPath = resolve(__dirname, relPnpApiPath); 10 | const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath); 11 | 12 | if (existsSync(absPnpApiPath)) { 13 | if (!process.versions.pnp) { 14 | // Setup the environment to be able to require eslint/lib/api.js 15 | require(absPnpApiPath).setup(); 16 | } 17 | } 18 | 19 | // Defer to the real eslint/lib/api.js your application uses 20 | module.exports = absRequire(`eslint/lib/api.js`); 21 | -------------------------------------------------------------------------------- /.yarn/sdks/typescript/bin/tsc: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const {existsSync} = require(`fs`); 4 | const {createRequire, createRequireFromPath} = require(`module`); 5 | const {resolve} = require(`path`); 6 | 7 | const relPnpApiPath = "../../../../.pnp.js"; 8 | 9 | const absPnpApiPath = resolve(__dirname, relPnpApiPath); 10 | const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath); 11 | 12 | if (existsSync(absPnpApiPath)) { 13 | if (!process.versions.pnp) { 14 | // Setup the environment to be able to require typescript/bin/tsc 15 | require(absPnpApiPath).setup(); 16 | } 17 | } 18 | 19 | // Defer to the real typescript/bin/tsc your application uses 20 | module.exports = absRequire(`typescript/bin/tsc`); 21 | -------------------------------------------------------------------------------- /.yarn/sdks/eslint/bin/eslint.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const {existsSync} = require(`fs`); 4 | const {createRequire, createRequireFromPath} = require(`module`); 5 | const {resolve} = require(`path`); 6 | 7 | const relPnpApiPath = "../../../../.pnp.js"; 8 | 9 | const absPnpApiPath = resolve(__dirname, relPnpApiPath); 10 | const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath); 11 | 12 | if (existsSync(absPnpApiPath)) { 13 | if (!process.versions.pnp) { 14 | // Setup the environment to be able to require eslint/bin/eslint.js 15 | require(absPnpApiPath).setup(); 16 | } 17 | } 18 | 19 | // Defer to the real eslint/bin/eslint.js your application uses 20 | module.exports = absRequire(`eslint/bin/eslint.js`); 21 | -------------------------------------------------------------------------------- /packages/changed/src/utils/listChangedWorkspaces.ts: -------------------------------------------------------------------------------- 1 | import { Project, Workspace } from '@yarnpkg/core'; 2 | import getWorkspaceDependents from './getWorkspaceDependents'; 3 | 4 | export default function listChangedWorkspaces( 5 | project: Project, 6 | files: readonly string[], 7 | ): readonly Workspace[] { 8 | const workspaces = new Set(); 9 | 10 | for (const ws of project.workspaces) { 11 | const changed = files.some((path) => path.startsWith(ws.relativeCwd)); 12 | 13 | if (changed && !workspaces.has(ws)) { 14 | workspaces.add(ws); 15 | 16 | for (const dep of getWorkspaceDependents(ws)) { 17 | workspaces.add(dep); 18 | } 19 | } 20 | } 21 | 22 | return [...workspaces]; 23 | } 24 | -------------------------------------------------------------------------------- /.yarn/sdks/typescript/lib/tsc.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const {existsSync} = require(`fs`); 4 | const {createRequire, createRequireFromPath} = require(`module`); 5 | const {resolve} = require(`path`); 6 | 7 | const relPnpApiPath = "../../../../.pnp.js"; 8 | 9 | const absPnpApiPath = resolve(__dirname, relPnpApiPath); 10 | const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath); 11 | 12 | if (existsSync(absPnpApiPath)) { 13 | if (!process.versions.pnp) { 14 | // Setup the environment to be able to require typescript/lib/tsc.js 15 | require(absPnpApiPath).setup(); 16 | } 17 | } 18 | 19 | // Defer to the real typescript/lib/tsc.js your application uses 20 | module.exports = absRequire(`typescript/lib/tsc.js`); 21 | -------------------------------------------------------------------------------- /packages/docker-build/src/utils/execUtils.ts: -------------------------------------------------------------------------------- 1 | // Copy from @yarnpkg/plugin-exec 2 | // https://github.com/yarnpkg/berry/blob/63a77b5/packages/plugin-exec/sources/execUtils.ts 3 | 4 | import { Locator, structUtils } from '@yarnpkg/core'; 5 | import { npath, PortablePath } from '@yarnpkg/fslib'; 6 | 7 | export function parseSpec( 8 | spec: string, 9 | ): { parentLocator: Locator | null; path: PortablePath } | undefined { 10 | const { params, selector } = structUtils.parseRange(spec); 11 | 12 | const path = npath.toPortablePath(selector); 13 | 14 | const parentLocator = 15 | params && typeof params.locator === `string` 16 | ? structUtils.parseLocator(params.locator) 17 | : null; 18 | 19 | return { parentLocator, path }; 20 | } 21 | -------------------------------------------------------------------------------- /.yarn/sdks/typescript/bin/tsserver: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const {existsSync} = require(`fs`); 4 | const {createRequire, createRequireFromPath} = require(`module`); 5 | const {resolve} = require(`path`); 6 | 7 | const relPnpApiPath = "../../../../.pnp.js"; 8 | 9 | const absPnpApiPath = resolve(__dirname, relPnpApiPath); 10 | const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath); 11 | 12 | if (existsSync(absPnpApiPath)) { 13 | if (!process.versions.pnp) { 14 | // Setup the environment to be able to require typescript/bin/tsserver 15 | require(absPnpApiPath).setup(); 16 | } 17 | } 18 | 19 | // Defer to the real typescript/bin/tsserver your application uses 20 | module.exports = absRequire(`typescript/bin/tsserver`); 21 | -------------------------------------------------------------------------------- /packages/docker-build/src/utils/getDockerFilePath.ts: -------------------------------------------------------------------------------- 1 | import { Workspace } from '@yarnpkg/core'; 2 | import { PortablePath, toFilename, ppath, xfs } from '@yarnpkg/fslib'; 3 | 4 | export default async function getDockerFilePath( 5 | workspace: Workspace, 6 | filename = 'Dockerfile', 7 | ): Promise { 8 | const path = toFilename(filename); 9 | 10 | if (ppath.isAbsolute(path)) { 11 | return path; 12 | } 13 | 14 | const candidates = [ 15 | ppath.join(workspace.cwd, path), 16 | ppath.join(workspace.project.cwd, path), 17 | ]; 18 | 19 | for (const candidate of candidates) { 20 | if (await xfs.existsPromise(candidate)) { 21 | return candidate; 22 | } 23 | } 24 | 25 | throw new Error('Dockerfile is required'); 26 | } 27 | -------------------------------------------------------------------------------- /.yarn/sdks/typescript/lib/typescript.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const {existsSync} = require(`fs`); 4 | const {createRequire, createRequireFromPath} = require(`module`); 5 | const {resolve} = require(`path`); 6 | 7 | const relPnpApiPath = "../../../../.pnp.js"; 8 | 9 | const absPnpApiPath = resolve(__dirname, relPnpApiPath); 10 | const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath); 11 | 12 | if (existsSync(absPnpApiPath)) { 13 | if (!process.versions.pnp) { 14 | // Setup the environment to be able to require typescript/lib/typescript.js 15 | require(absPnpApiPath).setup(); 16 | } 17 | } 18 | 19 | // Defer to the real typescript/lib/typescript.js your application uses 20 | module.exports = absRequire(`typescript/lib/typescript.js`); 21 | -------------------------------------------------------------------------------- /packages/docker-build/src/utils/copyManifests.ts: -------------------------------------------------------------------------------- 1 | import { PortablePath, ppath, xfs } from '@yarnpkg/fslib'; 2 | import { Workspace, Manifest, Report } from '@yarnpkg/core'; 3 | 4 | export default async function copyManifests({ 5 | destination, 6 | workspaces, 7 | report, 8 | }: { 9 | destination: PortablePath; 10 | workspaces: Workspace[]; 11 | report: Report; 12 | }): Promise { 13 | for (const ws of workspaces) { 14 | const path = ppath.join(ws.relativeCwd, Manifest.fileName); 15 | const dest = ppath.join(destination, path); 16 | const data = {}; 17 | 18 | ws.manifest.exportTo(data); 19 | 20 | report.reportInfo(null, path); 21 | await xfs.mkdirpPromise(ppath.dirname(dest)); 22 | await xfs.writeJsonPromise(dest, data); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /packages/changed/src/utils/getWorkspaceDependencies.ts: -------------------------------------------------------------------------------- 1 | import { Workspace, Manifest } from '@yarnpkg/core'; 2 | 3 | export default function getWorkspaceDependencies( 4 | workspace: Workspace, 5 | ): readonly Workspace[] { 6 | const { project } = workspace; 7 | const dependencies = new Set(); 8 | 9 | function addDependency({ manifest }: Workspace): void { 10 | for (const depType of Manifest.hardDependencies) { 11 | for (const descriptor of manifest.getForScope(depType).values()) { 12 | const dep = project.tryWorkspaceByDescriptor(descriptor); 13 | 14 | if (dep && !dependencies.has(dep)) { 15 | dependencies.add(dep); 16 | addDependency(dep); 17 | } 18 | } 19 | } 20 | } 21 | 22 | addDependency(workspace); 23 | 24 | return [...dependencies]; 25 | } 26 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | on: 3 | push: 4 | pull_request: 5 | 6 | jobs: 7 | build: 8 | runs-on: ubuntu-20.04 9 | steps: 10 | - uses: actions/checkout@v3 11 | - uses: actions/setup-node@v3 12 | with: 13 | node-version: 14 14 | - uses: actions/cache@v3 15 | id: yarn-cache 16 | with: 17 | path: .yarn/cache 18 | key: ${{ runner.os }}-node-14-yarn-${{ hashFiles('**/yarn.lock') }} 19 | restore-keys: | 20 | ${{ runner.os }}-yarn- 21 | - run: yarn install --immutable 22 | - run: yarn constraints 23 | - run: yarn lint 24 | - run: yarn workspaces foreach --verbose --topological-dev --parallel --interlaced run build 25 | - uses: actions/upload-artifact@v3 26 | with: 27 | name: bundles 28 | path: packages/*/bundles/**/*.js 29 | - run: yarn test 30 | - run: yarn semantic-release 31 | env: 32 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 33 | -------------------------------------------------------------------------------- /packages/docker-build/src/utils/copyAdditional.ts: -------------------------------------------------------------------------------- 1 | import { PortablePath, xfs, ppath, toFilename } from '@yarnpkg/fslib'; 2 | import { Report } from '@yarnpkg/core'; 3 | 4 | function resolvePath(baseDir: PortablePath, inputPath: string): PortablePath { 5 | const path = toFilename(inputPath); 6 | 7 | if (ppath.isAbsolute(path)) { 8 | return ppath.relative(baseDir, path); 9 | } 10 | 11 | return path; 12 | } 13 | 14 | export default async function copyAdditional({ 15 | destination, 16 | files, 17 | dockerFilePath, 18 | report, 19 | }: { 20 | destination: PortablePath; 21 | files: string[]; 22 | dockerFilePath: PortablePath; 23 | report: Report; 24 | }): Promise { 25 | const baseDir = ppath.dirname(dockerFilePath); 26 | 27 | for (const file of files) { 28 | const path = resolvePath(baseDir, file); 29 | const src = ppath.join(baseDir, path); 30 | const dest = ppath.join(destination, path); 31 | 32 | report.reportInfo(null, path); 33 | await xfs.copyPromise(dest, src); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /packages/docker-build/src/utils/packWorkspace.ts: -------------------------------------------------------------------------------- 1 | import { Workspace, Report } from '@yarnpkg/core'; 2 | import { PortablePath, ppath, xfs } from '@yarnpkg/fslib'; 3 | import { packUtils } from '@yarnpkg/plugin-pack'; 4 | 5 | export default async function packWorkspace({ 6 | workspace, 7 | destination, 8 | report, 9 | }: { 10 | workspace: Workspace; 11 | destination: PortablePath; 12 | report: Report; 13 | }): Promise { 14 | await packUtils.prepareForPack(workspace, { report }, async () => { 15 | const files = await packUtils.genPackList(workspace); 16 | const progress = Report.progressViaCounter(files.length); 17 | const reportedProgress = report.reportProgress(progress); 18 | 19 | try { 20 | for (const file of files) { 21 | const src = ppath.join(workspace.cwd, file); 22 | const dest = ppath.join(destination, workspace.relativeCwd, file); 23 | 24 | report.reportInfo(null, file); 25 | await xfs.copyPromise(dest, src, { overwrite: true }); 26 | progress.tick(); 27 | } 28 | } finally { 29 | reportedProgress.stop(); 30 | } 31 | }); 32 | } 33 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Dcard Taiwan Ltd. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /integration/utils/TestWorkspace.ts: -------------------------------------------------------------------------------- 1 | import TestProject from './TestProject'; 2 | import { remove, outputJSON } from 'fs-extra'; 3 | import { join, posix } from 'path'; 4 | import execa from 'execa'; 5 | 6 | export default class TestWorkspace { 7 | private constructor( 8 | public readonly project: TestProject, 9 | public readonly name: string, 10 | ) {} 11 | 12 | public static async setup( 13 | project: TestProject, 14 | name: string, 15 | ): Promise { 16 | const ws = new TestWorkspace(project, name); 17 | 18 | // Create package.json 19 | await outputJSON(join(ws.path, 'package.json'), { 20 | name, 21 | private: true, 22 | }); 23 | 24 | return ws; 25 | } 26 | 27 | public get location(): string { 28 | return posix.join('packages', this.name); 29 | } 30 | 31 | public get path(): string { 32 | return join(this.project.path, this.location); 33 | } 34 | 35 | public async cleanup(): Promise { 36 | await remove(this.path); 37 | } 38 | 39 | // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types 40 | public yarn(args?: string[], options?: execa.Options) { 41 | return execa('yarn', args, { 42 | cwd: this.path, 43 | ...options, 44 | }); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /packages/docker-build/src/utils/getRequiredWorkspaces.ts: -------------------------------------------------------------------------------- 1 | import { Workspace, Project, Manifest } from '@yarnpkg/core'; 2 | 3 | export default function getRequiredWorkspaces({ 4 | project, 5 | workspaces, 6 | production = false, 7 | scopes = production ? ['dependencies'] : Manifest.hardDependencies, 8 | }: { 9 | project: Project; 10 | workspaces: Workspace[]; 11 | scopes?: string[]; 12 | production?: boolean; 13 | }): Set { 14 | const requiredWorkspaces = new Set([...workspaces]); 15 | 16 | for (const ws of requiredWorkspaces) { 17 | for (const scope of scopes) { 18 | const deps = ws.manifest.getForScope(scope).values(); 19 | 20 | for (const dep of deps) { 21 | const workspace = project.tryWorkspaceByDescriptor(dep); 22 | 23 | if (workspace) { 24 | requiredWorkspaces.add(workspace); 25 | } 26 | } 27 | } 28 | } 29 | 30 | for (const ws of project.workspaces) { 31 | if (requiredWorkspaces.has(ws)) { 32 | if (production) { 33 | ws.manifest.devDependencies.clear(); 34 | } 35 | } else { 36 | ws.manifest.dependencies.clear(); 37 | ws.manifest.devDependencies.clear(); 38 | ws.manifest.peerDependencies.clear(); 39 | } 40 | } 41 | 42 | return requiredWorkspaces; 43 | } 44 | -------------------------------------------------------------------------------- /packages/changed/src/commands/filter.ts: -------------------------------------------------------------------------------- 1 | import { BaseCommand } from '@yarnpkg/cli'; 2 | import { Command } from 'clipanion'; 3 | import { execUtils, Project, Workspace, structUtils } from '@yarnpkg/core'; 4 | import listChangedWorkspaces from '../utils/listChangedWorkspaces'; 5 | 6 | export abstract class FilterCommand extends BaseCommand { 7 | @Command.String('--git-range') 8 | public gitRange?: string; 9 | 10 | @Command.Boolean('--cached') 11 | public cached = false; 12 | 13 | @Command.Array('--include') 14 | public include?: string[]; 15 | 16 | @Command.Array('--exclude') 17 | public exclude?: string[]; 18 | 19 | protected async listWorkspaces( 20 | project: Project, 21 | ): Promise { 22 | const { stdout } = await execUtils.execvp( 23 | 'git', 24 | [ 25 | 'diff', 26 | '--name-only', 27 | ...(this.cached ? ['--cached'] : []), 28 | ...(this.gitRange ? [this.gitRange] : []), 29 | ], 30 | { 31 | cwd: project.cwd, 32 | strict: true, 33 | }, 34 | ); 35 | const files = stdout.split(/\r?\n/); 36 | const workspaces = listChangedWorkspaces(project, files); 37 | const include = this.include || []; 38 | const exclude = this.exclude || []; 39 | 40 | return workspaces.filter((ws) => { 41 | const name = structUtils.stringifyIdent(ws.locator); 42 | 43 | if (name) { 44 | if (include.length && !include.includes(name)) { 45 | return false; 46 | } 47 | 48 | if (exclude.length && exclude.includes(name)) { 49 | return false; 50 | } 51 | } 52 | 53 | return true; 54 | }); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "workspaces": [ 4 | "packages/*" 5 | ], 6 | "scripts": { 7 | "lint": "eslint . --ext .js,.ts", 8 | "test": "jest --config integration/jest.config.js" 9 | }, 10 | "husky": { 11 | "hooks": { 12 | "commit-msg": "commitlint -e", 13 | "pre-commit": "lint-staged" 14 | } 15 | }, 16 | "lint-staged": { 17 | "*.{js,ts}": [ 18 | "eslint --fix" 19 | ] 20 | }, 21 | "repository": { 22 | "type": "git", 23 | "url": "https://github.com/Dcard/yarn-plugins.git" 24 | }, 25 | "dependencies": { 26 | "@yarnpkg/pnpify": "^2.4.0" 27 | }, 28 | "devDependencies": { 29 | "@commitlint/cli": "^12.1.1", 30 | "@types/eslint": "7.2.0", 31 | "@types/eslint-plugin-prettier": "3.1.0", 32 | "@types/execa": "2.0.0", 33 | "@types/fs-extra": "9.0.1", 34 | "@types/globby": "9.1.0", 35 | "@types/jest": "^26.0.9", 36 | "@types/js-yaml": "3.12.5", 37 | "@types/prettier": "2.0.2", 38 | "@types/semantic-release": "17.1.0", 39 | "@typescript-eslint/eslint-plugin": "^4.0.1", 40 | "@typescript-eslint/parser": "^4.0.1", 41 | "eslint": "^7.8.1", 42 | "eslint-config-prettier": "^6.11.0", 43 | "eslint-plugin-jest": "^24.0.0", 44 | "eslint-plugin-prettier": "^3.1.4", 45 | "execa": "^4.0.3", 46 | "fs-extra": "^9.0.1", 47 | "globby": "^11.0.1", 48 | "husky": "^4.3.0", 49 | "jest": "^26.4.2", 50 | "jest-extended": "^0.11.5", 51 | "js-yaml": "^3.14.0", 52 | "lint-staged": "^10.3.0", 53 | "prettier": "^2.1.1", 54 | "semantic-release": "^17.1.1", 55 | "tmp-promise": "^3.0.2", 56 | "ts-jest": "26.3.0", 57 | "typescript": "^4.0.2" 58 | }, 59 | "packageManager": "yarn@2.4.0" 60 | } 61 | -------------------------------------------------------------------------------- /packages/docker-build/src/utils/copyProtocolFiles.ts: -------------------------------------------------------------------------------- 1 | import { 2 | Descriptor, 3 | Locator, 4 | Project, 5 | Report, 6 | structUtils, 7 | } from '@yarnpkg/core'; 8 | import { PortablePath, ppath, xfs } from '@yarnpkg/fslib'; 9 | 10 | // https://github.com/yarnpkg/berry/blob/d38d573/packages/plugin-patch/sources/patchUtils.ts#L10 11 | const BUILTIN_REGEXP = /^builtin<([^>]+)>$/; 12 | 13 | export default async function copyProtocolFiles({ 14 | destination, 15 | report, 16 | project, 17 | parseDescriptor, 18 | }: { 19 | destination: PortablePath; 20 | report: Report; 21 | project: Project; 22 | parseDescriptor: ( 23 | descriptor: Descriptor, 24 | ) => { parentLocator: Locator; paths: PortablePath[] } | undefined; 25 | }): Promise { 26 | const copiedPaths = new Set(); 27 | 28 | for (const descriptor of project.storedDescriptors.values()) { 29 | const resolvedDescriptor = structUtils.isVirtualDescriptor(descriptor) 30 | ? structUtils.devirtualizeDescriptor(descriptor) 31 | : descriptor; 32 | 33 | const parsed = parseDescriptor(resolvedDescriptor); 34 | if (!parsed) continue; 35 | 36 | const { parentLocator, paths } = parsed; 37 | 38 | for (const path of paths) { 39 | // Ignore builtin modules 40 | if (BUILTIN_REGEXP.test(path)) continue; 41 | 42 | // TODO: Handle absolute path 43 | if (ppath.isAbsolute(path)) continue; 44 | 45 | // Get the workspace by parentLocator 46 | const parentWorkspace = project.getWorkspaceByLocator(parentLocator); 47 | 48 | // The path relative to the project CWD 49 | const relativePath = ppath.join(parentWorkspace.relativeCwd, path); 50 | 51 | // Skip if the path has been copied already 52 | if (copiedPaths.has(relativePath)) continue; 53 | 54 | copiedPaths.add(relativePath); 55 | 56 | const src = ppath.join(parentWorkspace.cwd, path); 57 | const dest = ppath.join(destination, relativePath); 58 | 59 | report.reportInfo(null, relativePath); 60 | await xfs.mkdirpPromise(ppath.dirname(dest)); 61 | await xfs.copyFilePromise(src, dest); 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /packages/changed/src/commands/list.ts: -------------------------------------------------------------------------------- 1 | import { FilterCommand } from './filter'; 2 | import { Command } from 'clipanion'; 3 | import { 4 | Configuration, 5 | Project, 6 | StreamReport, 7 | structUtils, 8 | } from '@yarnpkg/core'; 9 | import { WorkspaceRequiredError } from '@yarnpkg/cli'; 10 | 11 | export default class ChangedListCommand extends FilterCommand { 12 | @Command.Boolean('--json') 13 | public json = false; 14 | 15 | public static usage = Command.Usage({ 16 | description: 'List changed workspaces and their dependents', 17 | details: ` 18 | If the \`--json\` flag is set the output will follow a JSON-stream output also known as NDJSON (https://github.com/ndjson/ndjson-spec). 19 | `, 20 | examples: [ 21 | [ 22 | 'Find changed files within a Git range', 23 | 'yarn changed list --git-range 93a9ed8..4ef2c61', 24 | ], 25 | [ 26 | 'Include or exclude workspaces', 27 | 'yarn changed list --include @foo/a --exclude @foo/b', 28 | ], 29 | ], 30 | }); 31 | 32 | @Command.Path('changed', 'list') 33 | public async execute(): Promise { 34 | const configuration = await Configuration.find( 35 | this.context.cwd, 36 | this.context.plugins, 37 | ); 38 | const { project, workspace } = await Project.find( 39 | configuration, 40 | this.context.cwd, 41 | ); 42 | 43 | if (!workspace) { 44 | throw new WorkspaceRequiredError(project.cwd, this.context.cwd); 45 | } 46 | 47 | const report = await StreamReport.start( 48 | { 49 | configuration, 50 | json: this.json, 51 | stdout: this.context.stdout, 52 | }, 53 | async (report) => { 54 | const workspaces = await this.listWorkspaces(project); 55 | 56 | for (const ws of workspaces) { 57 | report.reportInfo(null, ws.relativeCwd); 58 | report.reportJson({ 59 | name: ws.manifest.name 60 | ? structUtils.stringifyIdent(ws.manifest.name) 61 | : null, 62 | location: ws.relativeCwd, 63 | }); 64 | } 65 | }, 66 | ); 67 | 68 | return report.exitCode(); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /integration/utils/TestProject.ts: -------------------------------------------------------------------------------- 1 | import tmp from 'tmp-promise'; 2 | import { emptyDir, copy, outputFile, outputJSON, readFile } from 'fs-extra'; 3 | import { join, sep, posix, basename, extname } from 'path'; 4 | import { safeDump, safeLoad } from 'js-yaml'; 5 | import globby from 'globby'; 6 | import execa from 'execa'; 7 | 8 | const PROJECT_DIR = join(__dirname, '../..'); 9 | 10 | export default class TestProject { 11 | private constructor(private readonly tmpDir: tmp.DirectoryResult) {} 12 | 13 | public static async setup(): Promise { 14 | const dir = await tmp.dir(); 15 | const pluginBundles = await globby('packages/*/bundles/**/*.js', { 16 | cwd: PROJECT_DIR, 17 | }); 18 | const plugins = pluginBundles.map((src) => ({ 19 | src, 20 | name: '@yarnpkg/' + basename(src, extname(src)), 21 | dest: posix.join('.yarn', 'plugins', ...src.split(sep).slice(3)), 22 | })); 23 | 24 | for (const path of plugins) { 25 | await copy(join(PROJECT_DIR, path.src), join(dir.path, path.dest)); 26 | } 27 | 28 | const yarnConfig = safeLoad( 29 | await readFile(join(PROJECT_DIR, '.yarnrc.yml'), 'utf8'), 30 | ) as Record; 31 | 32 | // Create .yarnrc.yml 33 | await outputFile( 34 | join(dir.path, '.yarnrc.yml'), 35 | safeDump({ 36 | yarnPath: join(PROJECT_DIR, yarnConfig.yarnPath as string), 37 | plugins: plugins.map((plugin) => ({ 38 | path: plugin.dest, 39 | spec: plugin.name, 40 | })), 41 | }), 42 | ); 43 | 44 | // Create package.json 45 | await outputJSON(join(dir.path, 'package.json'), { 46 | private: true, 47 | workspaces: ['packages/*'], 48 | }); 49 | 50 | return new TestProject(dir); 51 | } 52 | 53 | public get path(): string { 54 | return this.tmpDir.path; 55 | } 56 | 57 | // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types 58 | public yarn(args?: string[], options?: execa.Options) { 59 | return execa('yarn', args, { 60 | cwd: this.tmpDir.path, 61 | ...options, 62 | }); 63 | } 64 | 65 | public async cleanup(): Promise { 66 | await emptyDir(this.tmpDir.path); 67 | await this.tmpDir.cleanup(); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /.yarn/sdks/typescript/lib/tsserver.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const {existsSync} = require(`fs`); 4 | const {createRequire, createRequireFromPath} = require(`module`); 5 | const {resolve} = require(`path`); 6 | 7 | const relPnpApiPath = "../../../../.pnp.js"; 8 | 9 | const absPnpApiPath = resolve(__dirname, relPnpApiPath); 10 | const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath); 11 | 12 | const moduleWrapper = tsserver => { 13 | // VSCode sends the zip paths to TS using the "zip://" prefix, that TS 14 | // doesn't understand. This layer makes sure to remove the protocol 15 | // before forwarding it to TS, and to add it back on all returned paths. 16 | 17 | const {isAbsolute} = require(`path`); 18 | 19 | const Session = tsserver.server.Session; 20 | const {onMessage: originalOnMessage, send: originalSend} = Session.prototype; 21 | 22 | return Object.assign(Session.prototype, { 23 | onMessage(/** @type {string} */ message) { 24 | return originalOnMessage.call(this, JSON.stringify(JSON.parse(message), (key, value) => { 25 | return typeof value === 'string' ? removeZipPrefix(value) : value; 26 | })); 27 | }, 28 | 29 | send(/** @type {any} */ msg) { 30 | return originalSend.call(this, JSON.parse(JSON.stringify(msg, (key, value) => { 31 | return typeof value === 'string' ? addZipPrefix(value) : value; 32 | }))); 33 | } 34 | }); 35 | 36 | function addZipPrefix(str) { 37 | // We add the `zip:` prefix to both `.zip/` paths and virtual paths 38 | if (isAbsolute(str) && !str.match(/^zip:/) && (str.match(/\.zip\//) || str.match(/\$\$virtual\//))) { 39 | // Absolute VSCode `Uri.fsPath`s need to start with a slash. 40 | // VSCode only adds it automatically for supported schemes, 41 | // so we have to do it manually for the `zip` scheme. 42 | return `zip:${str.replace(/^\/?/, `/`)}`; 43 | } else { 44 | return str; 45 | } 46 | } 47 | 48 | function removeZipPrefix(str) { 49 | return process.platform === 'win32' 50 | ? str.replace(/^zip:\//, ``) 51 | : str.replace(/^zip:/, ``); 52 | } 53 | }; 54 | 55 | if (existsSync(absPnpApiPath)) { 56 | if (!process.versions.pnp) { 57 | // Setup the environment to be able to require typescript/lib/tsserver.js 58 | require(absPnpApiPath).setup(); 59 | } 60 | } 61 | 62 | // Defer to the real typescript/lib/tsserver.js your application uses 63 | module.exports = moduleWrapper(absRequire(`typescript/lib/tsserver.js`)); 64 | -------------------------------------------------------------------------------- /packages/changed/README.md: -------------------------------------------------------------------------------- 1 | # yarn-plugin-changed 2 | 3 | List and run a command on changed workspaces and their dependents. 4 | 5 | ## Installation 6 | 7 | This plugin requires [@yarnpkg/plugin-workspace-tools](https://github.com/yarnpkg/berry/tree/master/packages/plugin-workspace-tools). 8 | 9 | ```sh 10 | yarn plugin import workspace-tools 11 | ``` 12 | 13 | Install the latest plugin. 14 | 15 | ```sh 16 | yarn plugin import https://github.com/Dcard/yarn-plugins/releases/latest/download/plugin-changed.js 17 | ``` 18 | 19 | ## CLI 20 | 21 | ### `yarn changed list` 22 | 23 | List changed workspaces and their dependents. 24 | 25 | #### `--git-range` 26 | 27 | Find changed files within a Git range. 28 | 29 | Example: 30 | 31 | ```sh 32 | yarn changed list --git-range master 33 | yarn changed list --git-range 93a9ed8..4ef2c61 34 | ``` 35 | 36 | #### `--cached` 37 | 38 | Look only at staged changes in git. Useful for local development. 39 | 40 | Example: 41 | 42 | ```sh 43 | yarn changed list --cached 44 | ``` 45 | 46 | #### `--include` 47 | 48 | Include workspaces. 49 | 50 | Example: 51 | 52 | ```sh 53 | yarn changed list --include @foo/a --include @foo/b 54 | ``` 55 | 56 | #### `--exclude` 57 | 58 | Exclude workspaces. 59 | 60 | Example: 61 | 62 | ```sh 63 | yarn changed list --exclude @foo/a --exclude @foo/b 64 | ``` 65 | 66 | #### `--json` 67 | 68 | Output in NDJSON format. 69 | 70 | Example: 71 | 72 | ```sh 73 | yarn changed list --json 74 | # {"name":"@foo/a","location":"packages/a"} 75 | # {"name":"@foo/b","location":"packages/b"} 76 | ``` 77 | 78 | ### `yarn changed foreach` 79 | 80 | Run a command on changed workspaces and their dependents. This command relies on `yarn workspaces foreach` command. See more information about the options [here](https://yarnpkg.com/cli/workspaces/foreach). 81 | 82 | #### `--git-range` 83 | 84 | See `yarn changed list`. 85 | 86 | #### `--cached` 87 | 88 | See `yarn changed list`. 89 | 90 | #### `--include` 91 | 92 | See `yarn changed list`. 93 | 94 | #### `--exclude` 95 | 96 | See `yarn changed list`. 97 | 98 | #### `-v,--verbose` 99 | 100 | Print more information. 101 | 102 | #### `-p,--parallel` 103 | 104 | Run tasks in parallel. 105 | 106 | #### `-i,--interlaced` 107 | 108 | Print the lines from the output immediately. Otherwise, Yarn will print the output after the source processes have exited. 109 | 110 | #### `-j,--jobs` 111 | 112 | Limit the number of parallel tasks. 113 | -------------------------------------------------------------------------------- /packages/docker-build/README.md: -------------------------------------------------------------------------------- 1 | # yarn-plugin-docker-build 2 | 3 | Build a Docker image for a workspace. 4 | 5 | ## Installation 6 | 7 | Install the latest plugin. 8 | 9 | ```sh 10 | yarn plugin import https://github.com/Dcard/yarn-plugins/releases/latest/download/plugin-docker-build.js 11 | ``` 12 | 13 | ## Dockerfile 14 | 15 | The following is a basic example of `Dockerfile`. 16 | 17 | ```dockerfile 18 | FROM node:18-alpine AS builder 19 | 20 | # Install dependencies for building native libraries 21 | RUN apk add --update git openssh-client python make gcc g++ 22 | 23 | WORKDIR /workspace 24 | 25 | # docker-build plugin copies everything needed for `yarn install` to `manifests` folder. 26 | COPY manifests ./ 27 | 28 | RUN yarn install --immutable 29 | 30 | # You can delete the cache folder after `yarn install` is done. 31 | RUN rm -rf .yarn/cache 32 | 33 | FROM node:18-alpine 34 | 35 | WORKDIR /workspace 36 | 37 | # Copy the installed dependencies from the previous stage. 38 | COPY --from=builder /workspace ./ 39 | 40 | # docker-build plugin runs `yarn pack` in all workspace dependencies and copies them to `packs` folder. 41 | COPY packs ./ 42 | 43 | CMD yarn workspace @foo/bar start 44 | ``` 45 | 46 | ## CLI 47 | 48 | ### `yarn docker build` 49 | 50 | This command will build a efficient Docker image which only contains production dependencies for the specified workspace. 51 | 52 | You have to create a `Dockerfile` in your workspace or your project. You can also specify the path to Dockerfile using the `-f, --file` option. 53 | 54 | Additional arguments can be passed to `docker build` directly, please check the Docker docs for more info: https://docs.docker.com/engine/reference/commandline/build/ 55 | 56 | Example: 57 | 58 | ```sh 59 | yarn docker build @foo/bar 60 | yarn docker build @foo/bar -t image-tag 61 | yarn docker build --copy secret.key --copy config.json @foo/bar 62 | ``` 63 | 64 | #### `-f,--file` 65 | 66 | Path to `Dockerfile`. Default to the Dockerfile in the workspace or the project. 67 | 68 | #### `--copy` 69 | 70 | Copy additional files to a Docker image. This is useful for secret keys or configuration files. The files will be copied to `manifests` folder. The path can be either a path relative to the Dockerfile or an absolute path. 71 | 72 | #### `--production` 73 | 74 | Install production dependencies only. 75 | 76 | #### `--buildkit` 77 | 78 | Build the Docker image using Docker BuildKit, please check the Docker docs for more info: https://docs.docker.com/engine/reference/commandline/buildx_build/ 79 | -------------------------------------------------------------------------------- /packages/changed/src/commands/foreach.ts: -------------------------------------------------------------------------------- 1 | import { FilterCommand } from './filter'; 2 | import { Command } from 'clipanion'; 3 | import { 4 | Configuration, 5 | Project, 6 | structUtils, 7 | StreamReport, 8 | } from '@yarnpkg/core'; 9 | import { WorkspaceRequiredError } from '@yarnpkg/cli'; 10 | 11 | export default class ChangedForeachCommand extends FilterCommand { 12 | @Command.String() 13 | commandName!: string; 14 | 15 | @Command.Proxy() 16 | args: string[] = []; 17 | 18 | @Command.Boolean('-v,--verbose') 19 | verbose = false; 20 | 21 | @Command.Boolean('-p,--parallel') 22 | parallel = false; 23 | 24 | @Command.Boolean('-i,--interlaced') 25 | interlaced = false; 26 | 27 | @Command.Boolean('-t,--topological') 28 | topological = false; 29 | 30 | @Command.String('-j,--jobs') 31 | jobs?: number; 32 | 33 | public static usage = Command.Usage({ 34 | description: 'Run a command on changed workspaces and their dependents', 35 | details: ` 36 | This command will run a given sub-command on changed workspaces and workspaces depends on them. 37 | 38 | Check the documentation for \`yarn workspace foreach\` for more details. 39 | `, 40 | examples: [ 41 | [ 42 | 'Run build scripts on changed workspaces', 43 | 'yarn changed foreach run build', 44 | ], 45 | [ 46 | 'Find changed files within a Git range', 47 | 'yarn changed foreach --git-range 93a9ed8..4ef2c61 run build', 48 | ], 49 | ], 50 | }); 51 | 52 | @Command.Path('changed', 'foreach') 53 | public async execute(): Promise { 54 | const configuration = await Configuration.find( 55 | this.context.cwd, 56 | this.context.plugins, 57 | ); 58 | const { project, workspace } = await Project.find( 59 | configuration, 60 | this.context.cwd, 61 | ); 62 | 63 | if (!workspace) { 64 | throw new WorkspaceRequiredError(project.cwd, this.context.cwd); 65 | } 66 | 67 | const workspaces = await this.listWorkspaces(project); 68 | 69 | if (!workspaces.length) { 70 | const report = await StreamReport.start( 71 | { 72 | configuration, 73 | stdout: this.context.stdout, 74 | }, 75 | async (report) => { 76 | report.reportInfo(null, 'No workspaces changed'); 77 | }, 78 | ); 79 | 80 | return report.exitCode(); 81 | } 82 | 83 | return this.cli.run( 84 | [ 85 | 'workspaces', 86 | 'foreach', 87 | ...workspaces.reduce( 88 | (acc, ws) => [ 89 | ...acc, 90 | '--include', 91 | structUtils.stringifyIdent(ws.locator), 92 | ], 93 | [] as string[], 94 | ), 95 | ...(this.verbose ? ['--verbose'] : []), 96 | ...(this.parallel ? ['--parallel'] : []), 97 | ...(this.interlaced ? ['--interlaced'] : []), 98 | ...(this.topological ? ['--topological'] : []), 99 | ...(this.jobs ? ['--jobs', `${this.jobs}`] : []), 100 | this.commandName, 101 | ...this.args, 102 | ], 103 | { 104 | cwd: project.cwd, 105 | }, 106 | ); 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /packages/tsconfig-references/src/index.ts: -------------------------------------------------------------------------------- 1 | import { Plugin, Workspace, Descriptor } from '@yarnpkg/core'; 2 | import { Hooks, suggestUtils } from '@yarnpkg/plugin-essentials'; 3 | import { ppath, toFilename, xfs, PortablePath } from '@yarnpkg/fslib'; 4 | import detectIndent from 'detect-indent'; 5 | 6 | function getTsConfigPath(workspace: Workspace): PortablePath { 7 | return ppath.join(workspace.cwd, toFilename('tsconfig.json')); 8 | } 9 | 10 | interface TsReference { 11 | path: string; 12 | } 13 | 14 | interface TsConfig { 15 | indent: string; 16 | newLineEOF: string; 17 | references?: TsReference[]; 18 | [key: string]: unknown; 19 | } 20 | 21 | async function readTsConfig( 22 | workspace: Workspace, 23 | ): Promise { 24 | const path = getTsConfigPath(workspace); 25 | const exist = await xfs.existsPromise(path); 26 | if (!exist) return; 27 | 28 | const content = await xfs.readFilePromise(path, 'utf8'); 29 | 30 | return { 31 | ...JSON.parse(content), 32 | indent: detectIndent(content).indent, 33 | newLineEOF: getNewLineAtEOF(content), 34 | }; 35 | } 36 | 37 | async function writeTsConfig( 38 | workspace: Workspace, 39 | { indent, newLineEOF, ...tsConfig }: TsConfig, 40 | ): Promise { 41 | const path = getTsConfigPath(workspace); 42 | await xfs.writeFilePromise( 43 | path, 44 | JSON.stringify(tsConfig, null, indent) + newLineEOF, 45 | ); 46 | } 47 | 48 | async function isTsWorkspace(workspace: Workspace): Promise { 49 | return xfs.existsPromise(getTsConfigPath(workspace)); 50 | } 51 | 52 | function uniqTsReference(references: TsReference[]): TsReference[] { 53 | const obj: Record = {}; 54 | 55 | for (const ref of references) { 56 | obj[ref.path] = ref; 57 | } 58 | 59 | return Object.values(obj); 60 | } 61 | 62 | function getReferencePath(source: Workspace, target: Workspace): PortablePath { 63 | return ppath.relative(source.cwd, target.cwd); 64 | } 65 | 66 | async function afterWorkspaceDependencyAddition( 67 | workspace: Workspace, 68 | target: suggestUtils.Target, 69 | descriptor: Descriptor, 70 | ): Promise { 71 | const targetWorkspace = workspace.project.tryWorkspaceByDescriptor( 72 | descriptor, 73 | ); 74 | 75 | if (!targetWorkspace || !(await isTsWorkspace(targetWorkspace))) { 76 | return; 77 | } 78 | 79 | const tsConfig = await readTsConfig(workspace); 80 | if (!tsConfig) return; 81 | 82 | await writeTsConfig(workspace, { 83 | ...tsConfig, 84 | references: uniqTsReference([ 85 | ...(tsConfig.references || []), 86 | { path: getReferencePath(workspace, targetWorkspace) }, 87 | ]), 88 | }); 89 | } 90 | 91 | async function afterWorkspaceDependencyRemoval( 92 | workspace: Workspace, 93 | target: suggestUtils.Target, 94 | descriptor: Descriptor, 95 | ): Promise { 96 | const targetWorkspace = workspace.project.tryWorkspaceByDescriptor( 97 | descriptor, 98 | ); 99 | 100 | if (!targetWorkspace || !(await isTsWorkspace(targetWorkspace))) { 101 | return; 102 | } 103 | 104 | const tsConfig = await readTsConfig(workspace); 105 | if (!tsConfig) return; 106 | 107 | const refPath = getReferencePath(workspace, targetWorkspace); 108 | 109 | await writeTsConfig(workspace, { 110 | ...tsConfig, 111 | ...(tsConfig.references && 112 | tsConfig.references.length && { 113 | references: uniqTsReference( 114 | tsConfig.references.filter((ref) => ref.path !== refPath), 115 | ), 116 | }), 117 | }); 118 | } 119 | 120 | const plugin: Plugin = { 121 | hooks: { 122 | afterWorkspaceDependencyAddition, 123 | afterWorkspaceDependencyRemoval, 124 | }, 125 | }; 126 | 127 | export default plugin; 128 | 129 | function getNewLineAtEOF(input: string) { 130 | const length = input.length; 131 | 132 | if (input[length - 1] === '\n') { 133 | if (input[length - 2] === '\r') { 134 | return '\r\n'; 135 | } 136 | 137 | return '\n'; 138 | } 139 | 140 | return ''; 141 | } 142 | -------------------------------------------------------------------------------- /integration/tsconfig-references/__tests__/index.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable @typescript-eslint/no-explicit-any */ 2 | import 'jest-extended'; 3 | import TestProject from '../../utils/TestProject'; 4 | import TestWorkspace from '../../utils/TestWorkspace'; 5 | import { outputJSON, readJSON, pathExists, remove } from 'fs-extra'; 6 | import { join } from 'path'; 7 | 8 | let project: TestProject; 9 | let workspaces: TestWorkspace[]; 10 | 11 | beforeAll(async () => { 12 | project = await TestProject.setup(); 13 | workspaces = await Promise.all([ 14 | TestWorkspace.setup(project, 'test-a'), 15 | TestWorkspace.setup(project, 'test-b'), 16 | ]); 17 | 18 | await project.yarn(); 19 | }); 20 | 21 | afterAll(async () => { 22 | await project?.cleanup(); 23 | }); 24 | 25 | function getTsConfigPath(ws: TestWorkspace): string { 26 | return join(ws.path, 'tsconfig.json'); 27 | } 28 | 29 | function readTsConfig(ws: TestWorkspace): Promise { 30 | return readJSON(getTsConfigPath(ws)); 31 | } 32 | 33 | async function writeTsConfig(ws: TestWorkspace, data: unknown): Promise { 34 | await outputJSON(getTsConfigPath(ws), data); 35 | } 36 | 37 | async function deleteTsConfig(ws: TestWorkspace): Promise { 38 | await remove(getTsConfigPath(ws)); 39 | } 40 | 41 | async function setupTsConfig(data: unknown): Promise { 42 | beforeAll(async () => { 43 | await writeTsConfig(workspaces[0], data); 44 | }); 45 | 46 | afterAll(async () => { 47 | await deleteTsConfig(workspaces[0]); 48 | }); 49 | } 50 | 51 | function testTsConfig({ references, ...options }: Record): void { 52 | it('check tsconfig.json', async () => { 53 | const actual = await readTsConfig(workspaces[0]); 54 | const entries = Object.entries(options); 55 | 56 | if (references) { 57 | entries.push(['references', expect.arrayContaining(references)]); 58 | } 59 | 60 | expect(actual).toContainAllEntries(entries); 61 | }); 62 | } 63 | 64 | describe('add workspace', () => { 65 | beforeEach(async () => { 66 | await workspaces[0].yarn(['add', workspaces[1].name]); 67 | }); 68 | 69 | afterEach(async () => { 70 | await workspaces[0].yarn(['remove', workspaces[1].name]); 71 | }); 72 | 73 | describe('when tsconfig.json does not exist', () => { 74 | it('should not create tsconfig.json', async () => { 75 | expect(await pathExists(getTsConfigPath(workspaces[0]))).toBeFalse(); 76 | }); 77 | }); 78 | 79 | describe('when tsconfig.json exist', () => { 80 | describe('target workspace does not have tsconfig.json', () => { 81 | setupTsConfig({}); 82 | 83 | testTsConfig({}); 84 | }); 85 | 86 | describe('target workspace has tsconfig.json', () => { 87 | beforeAll(async () => { 88 | await writeTsConfig(workspaces[1], {}); 89 | }); 90 | 91 | afterAll(async () => { 92 | await deleteTsConfig(workspaces[1]); 93 | }); 94 | 95 | describe('references does not exist', () => { 96 | setupTsConfig({ 97 | compilerOptions: {}, 98 | }); 99 | 100 | testTsConfig({ 101 | compilerOptions: {}, 102 | references: [{ path: '../test-b' }], 103 | }); 104 | }); 105 | 106 | describe('references exist', () => { 107 | describe('references contain the workspace', () => { 108 | setupTsConfig({ 109 | references: [{ path: '../test-b' }, { path: '../test-c' }], 110 | }); 111 | 112 | testTsConfig({ 113 | references: [{ path: '../test-b' }, { path: '../test-c' }], 114 | }); 115 | }); 116 | 117 | describe('references does not contain the workspace', () => { 118 | setupTsConfig({ 119 | references: [{ path: '../test-c' }], 120 | }); 121 | 122 | testTsConfig({ 123 | references: [{ path: '../test-b' }, { path: '../test-c' }], 124 | }); 125 | }); 126 | }); 127 | }); 128 | }); 129 | }); 130 | 131 | describe('remove workspace', () => { 132 | beforeAll(async () => { 133 | await workspaces[0].yarn(['add', workspaces[1].name]); 134 | }); 135 | 136 | beforeEach(async () => { 137 | await workspaces[0].yarn(['remove', workspaces[1].name]); 138 | }); 139 | 140 | afterEach(async () => { 141 | await workspaces[0].yarn(['add', workspaces[1].name]); 142 | }); 143 | 144 | describe('when tsconfig.json does not exist', () => { 145 | it('should not create tsconfig.json', async () => { 146 | expect(await pathExists(getTsConfigPath(workspaces[0]))).toBeFalse(); 147 | }); 148 | }); 149 | 150 | describe('when tsconfig.json exist', () => { 151 | describe('references does not exist', () => { 152 | setupTsConfig({ 153 | compilerOptions: {}, 154 | }); 155 | 156 | testTsConfig({ 157 | compilerOptions: {}, 158 | }); 159 | }); 160 | 161 | describe('references exist', () => { 162 | describe('references contain the workspace', () => { 163 | setupTsConfig({ 164 | references: [{ path: '../test-b' }, { path: '../test-c' }], 165 | }); 166 | 167 | testTsConfig({ 168 | references: [{ path: '../test-c' }], 169 | }); 170 | }); 171 | 172 | describe('references does not contain the workspace', () => { 173 | setupTsConfig({ 174 | references: [{ path: '../test-c' }], 175 | }); 176 | 177 | testTsConfig({ 178 | references: [{ path: '../test-c' }], 179 | }); 180 | }); 181 | }); 182 | }); 183 | }); 184 | 185 | describe('add npm package', () => { 186 | const packageName = 'isobject'; 187 | 188 | beforeEach(async () => { 189 | await workspaces[0].yarn(['add', packageName]); 190 | }); 191 | 192 | afterEach(async () => { 193 | await workspaces[0].yarn(['remove', packageName]); 194 | }); 195 | 196 | describe('when tsconfig.json exist', () => { 197 | setupTsConfig({}); 198 | 199 | testTsConfig({}); 200 | }); 201 | }); 202 | -------------------------------------------------------------------------------- /packages/docker-build/src/commands/build.ts: -------------------------------------------------------------------------------- 1 | import { BaseCommand } from '@yarnpkg/cli'; 2 | import { Command } from 'clipanion'; 3 | import { 4 | Configuration, 5 | Project, 6 | Cache, 7 | structUtils, 8 | StreamReport, 9 | execUtils, 10 | } from '@yarnpkg/core'; 11 | import { patchUtils } from '@yarnpkg/plugin-patch'; 12 | import getDockerFilePath from '../utils/getDockerFilePath'; 13 | import getRequiredWorkspaces from '../utils/getRequiredWorkspaces'; 14 | import copyRcFile from '../utils/copyRcFile'; 15 | import { toFilename, ppath, xfs } from '@yarnpkg/fslib'; 16 | import copyPlugins from '../utils/copyPlugins'; 17 | import copyYarnRelease from '../utils/copyYarnRelease'; 18 | import copyManifests from '../utils/copyManifests'; 19 | import copyCacheMarkedFiles from '../utils/copyCacheMarkedFiles'; 20 | import generateLockfile from '../utils/generateLockfile'; 21 | import packWorkspace from '../utils/packWorkspace'; 22 | import copyAdditional from '../utils/copyAdditional'; 23 | import copyProtocolFiles from '../utils/copyProtocolFiles'; 24 | import { parseSpec } from '../utils/execUtils'; 25 | 26 | export default class DockerBuildCommand extends BaseCommand { 27 | @Command.String() 28 | public workspaceName!: string; 29 | 30 | @Command.Proxy() 31 | public args: string[] = []; 32 | 33 | @Command.String('-f,--file') 34 | public dockerFilePath?: string; 35 | 36 | @Command.Array('--copy') 37 | public copyFiles?: string[]; 38 | 39 | @Command.Boolean('--production') 40 | public production?: boolean; 41 | 42 | @Command.Boolean('--buildkit') 43 | public buildKit?: boolean; 44 | 45 | public static usage = Command.Usage({ 46 | category: 'Docker-related commands', 47 | description: 'Build a Docker image for a workspace', 48 | details: ` 49 | This command will build a efficient Docker image which only contains necessary dependencies for the specified workspace. 50 | 51 | You have to create a Dockerfile in your workspace or your project. You can also specify the path to Dockerfile using the "-f, --file" option. 52 | 53 | Additional arguments can be passed to "docker build" directly, please check the Docker docs for more info: https://docs.docker.com/engine/reference/commandline/build/ 54 | 55 | You can copy additional files or folders to a Docker image using the "--copy" option. This is useful for secret keys or configuration files. The files will be copied to "manifests" folder. The path can be either a path relative to the Dockerfile or an absolute path. 56 | `, 57 | examples: [ 58 | ['Build a Docker image for a workspace', 'yarn docker build @foo/bar'], 59 | [ 60 | 'Pass additional arguments to docker build command', 61 | 'yarn docker build @foo/bar -t image-tag', 62 | ], 63 | [ 64 | 'Copy additional files to a Docker image', 65 | 'yarn docker build --copy secret.key --copy config.json @foo/bar', 66 | ], 67 | [ 68 | 'Install production dependencies only', 69 | 'yarn docker build --production @foo/bar', 70 | ], 71 | [ 72 | 'Build a Docker image using BuildKit', 73 | 'yarn docker build --buildkit @foo/bar', 74 | ], 75 | ], 76 | }); 77 | 78 | @Command.Path('docker', 'build') 79 | public async execute(): Promise { 80 | const configuration = await Configuration.find( 81 | this.context.cwd, 82 | this.context.plugins, 83 | ); 84 | const { project } = await Project.find(configuration, this.context.cwd); 85 | 86 | const workspace = project.getWorkspaceByIdent( 87 | structUtils.parseIdent(this.workspaceName), 88 | ); 89 | 90 | const requiredWorkspaces = getRequiredWorkspaces({ 91 | project, 92 | workspaces: [workspace], 93 | production: this.production, 94 | }); 95 | 96 | const dockerFilePath = await getDockerFilePath( 97 | workspace, 98 | this.dockerFilePath, 99 | ); 100 | 101 | const cache = await Cache.find(configuration); 102 | 103 | const report = await StreamReport.start( 104 | { 105 | configuration, 106 | stdout: this.context.stdout, 107 | includeLogs: !this.context.quiet, 108 | }, 109 | async (report) => { 110 | await report.startTimerPromise('Resolution Step', async () => { 111 | await project.resolveEverything({ report, cache }); 112 | }); 113 | 114 | await report.startTimerPromise('Fetch Step', async () => { 115 | await project.fetchEverything({ report, cache }); 116 | }); 117 | 118 | await xfs.mktempPromise(async (cwd) => { 119 | const manifestDir = ppath.join(cwd, toFilename('manifests')); 120 | const packDir = ppath.join(cwd, toFilename('packs')); 121 | 122 | await report.startTimerPromise('Copy files', async () => { 123 | await copyRcFile({ 124 | destination: manifestDir, 125 | project, 126 | report, 127 | }); 128 | 129 | await copyPlugins({ 130 | destination: manifestDir, 131 | project, 132 | report, 133 | }); 134 | 135 | await copyYarnRelease({ 136 | destination: manifestDir, 137 | project, 138 | report, 139 | }); 140 | 141 | await copyManifests({ 142 | destination: manifestDir, 143 | workspaces: project.workspaces, 144 | report, 145 | }); 146 | 147 | await copyProtocolFiles({ 148 | destination: manifestDir, 149 | report, 150 | project, 151 | parseDescriptor: (descriptor) => { 152 | if (descriptor.range.startsWith('exec:')) { 153 | const parsed = parseSpec(descriptor.range); 154 | if (!parsed || !parsed.parentLocator) return; 155 | return { 156 | parentLocator: parsed.parentLocator, 157 | paths: [parsed.path], 158 | }; 159 | } else if (descriptor.range.startsWith('patch:')) { 160 | const { 161 | parentLocator, 162 | patchPaths: paths, 163 | } = patchUtils.parseDescriptor(descriptor); 164 | if (!parentLocator) return; 165 | return { parentLocator, paths }; 166 | } 167 | }, 168 | }); 169 | 170 | await copyCacheMarkedFiles({ 171 | destination: manifestDir, 172 | project, 173 | cache, 174 | report, 175 | }); 176 | 177 | await generateLockfile({ 178 | destination: manifestDir, 179 | project, 180 | report, 181 | }); 182 | 183 | if (this.copyFiles && this.copyFiles.length) { 184 | await copyAdditional({ 185 | destination: manifestDir, 186 | files: this.copyFiles, 187 | dockerFilePath, 188 | report, 189 | }); 190 | } 191 | }); 192 | 193 | for (const ws of requiredWorkspaces) { 194 | const name = ws.manifest.name 195 | ? structUtils.stringifyIdent(ws.manifest.name) 196 | : ''; 197 | 198 | await report.startTimerPromise( 199 | `Pack workspace ${name}`, 200 | async () => { 201 | await packWorkspace({ 202 | workspace: ws, 203 | report, 204 | destination: packDir, 205 | }); 206 | }, 207 | ); 208 | } 209 | 210 | const buildCommand = this.buildKit ? ['buildx', 'build'] : ['build']; 211 | 212 | await execUtils.pipevp( 213 | 'docker', 214 | [...buildCommand, ...this.args, '-f', dockerFilePath, '.'], 215 | { 216 | cwd, 217 | strict: true, 218 | stdin: this.context.stdin, 219 | stdout: this.context.stdout, 220 | stderr: this.context.stderr, 221 | }, 222 | ); 223 | }); 224 | }, 225 | ); 226 | 227 | return report.exitCode(); 228 | } 229 | } 230 | -------------------------------------------------------------------------------- /.yarn/plugins/@yarnpkg/plugin-typescript.cjs: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | module.exports = { 3 | name: "@yarnpkg/plugin-typescript", 4 | factory: function (require) { 5 | var plugin;plugin=(()=>{var e={948:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>u});var s=r(966),a=r(850),o=r(513),n=r.n(o),i=r(410),c=r.n(i);const d=e=>{const t={async send(t){try{const r=await s.httpUtils.request(t.url,t.data||null,{configuration:e,headers:t.headers});return{content:r.body,isTimedOut:!1,status:r.statusCode}}catch(e){return{content:e.response.body,isTimedOut:!1,status:e.response.statusCode}}}};return c()("OFCNCOG2CU","e8e1bd300d860104bb8c58453ffa1eb4",{requester:t})},l=e=>e.scope?`${e.scope}__${e.name}`:""+e.name,u={hooks:{afterWorkspaceDependencyAddition:async(e,t,r,o)=>{if("types"===r.scope)return;const{project:i}=e,{configuration:c}=i,u=c.makeResolver(),p={project:i,resolver:u,report:new s.ThrowReport};if(!await(async(e,t)=>{var r;const a=s.structUtils.stringifyIdent(e),o=d(t).initIndex("npm-search");try{return"definitely-typed"===(null===(r=(await o.getObject(a,{attributesToRetrieve:["types"]})).types)||void 0===r?void 0:r.ts)}catch(e){return!1}})(r,c))return;const m=l(r);let h=s.structUtils.parseRange(r.range).selector;if(!n().validRange(h)){const e=await u.getCandidates(r,new Map,p);h=s.structUtils.parseRange(e[0].reference).selector}const y=n().coerce(h);if(null===y)return;const g=`${a.suggestUtils.Modifier.CARET}${y.major}`,b=s.structUtils.makeDescriptor(s.structUtils.makeIdent("types",m),g),f=s.miscUtils.mapAndFind(i.workspaces,e=>{var t,a;const o=null===(t=e.manifest.dependencies.get(r.identHash))||void 0===t?void 0:t.descriptorHash,n=null===(a=e.manifest.devDependencies.get(r.identHash))||void 0===a?void 0:a.descriptorHash;if(o!==r.descriptorHash&&n!==r.descriptorHash)return s.miscUtils.mapAndFind.skip;const i=[];for(const t of s.Manifest.allDependencies){const r=e.manifest[t].get(b.identHash);void 0!==r&&i.push([t,r])}return 0===i.length?s.miscUtils.mapAndFind.skip:i});if(void 0!==f)for(const[t,r]of f)e.manifest[t].set(r.identHash,r);else{try{if(0===(await u.getCandidates(b,new Map,p)).length)return}catch(e){return}e.manifest[a.suggestUtils.Target.DEVELOPMENT].set(b.identHash,b)}},afterWorkspaceDependencyRemoval:async(e,t,r)=>{if("types"===r.scope)return;const a=l(r),o=s.structUtils.makeIdent("types",a);for(const t of s.Manifest.allDependencies){void 0!==e.manifest[t].get(o.identHash)&&e.manifest[t].delete(o.identHash)}},beforeWorkspacePacking:(e,t)=>{t.publishConfig&&t.publishConfig.typings&&(t.typings=t.publishConfig.typings),t.publishConfig&&t.publishConfig.types&&(t.types=t.publishConfig.types)}}}},469:(e,t,r)=>{"use strict";function s(e){const t=[...e.caches],r=t.shift();return void 0===r?a():{get:(e,a,o={miss:()=>Promise.resolve()})=>r.get(e,a,o).catch(()=>s({caches:t}).get(e,a,o)),set:(e,a)=>r.set(e,a).catch(()=>s({caches:t}).set(e,a)),delete:e=>r.delete(e).catch(()=>s({caches:t}).delete(e)),clear:()=>r.clear().catch(()=>s({caches:t}).clear())}}function a(){return{get:(e,t,r={miss:()=>Promise.resolve()})=>t().then(e=>Promise.all([e,r.miss(e)])).then(([e])=>e),set:(e,t)=>Promise.resolve(t),delete:e=>Promise.resolve(),clear:()=>Promise.resolve()}}r.r(t),r.d(t,{createFallbackableCache:()=>s,createNullCache:()=>a})},712:(e,t,r)=>{"use strict";function s(e={serializable:!0}){let t={};return{get(r,s,a={miss:()=>Promise.resolve()}){const o=JSON.stringify(r);if(o in t)return Promise.resolve(e.serializable?JSON.parse(t[o]):t[o]);const n=s(),i=a&&a.miss||(()=>Promise.resolve());return n.then(e=>i(e)).then(()=>n)},set:(r,s)=>(t[JSON.stringify(r)]=e.serializable?JSON.stringify(s):s,Promise.resolve(s)),delete:e=>(delete t[JSON.stringify(e)],Promise.resolve()),clear:()=>(t={},Promise.resolve())}}r.r(t),r.d(t,{createInMemoryCache:()=>s})},223:(e,t,r)=>{"use strict";r.r(t),r.d(t,{addABTest:()=>i,createAnalyticsClient:()=>n,deleteABTest:()=>c,getABTest:()=>d,getABTests:()=>l,stopABTest:()=>u});var s=r(757),a=r(858),o=r(541);const n=e=>{const t=e.region||"us",r=(0,s.createAuth)(s.AuthMode.WithinHeaders,e.appId,e.apiKey),o=(0,a.createTransporter)({hosts:[{url:`analytics.${t}.algolia.com`}],...e,headers:{...r.headers(),"content-type":"application/json",...e.headers},queryParameters:{...r.queryParameters(),...e.queryParameters}}),n=e.appId;return(0,s.addMethods)({appId:n,transporter:o},e.methods)},i=e=>(t,r)=>e.transporter.write({method:o.N.Post,path:"2/abtests",data:t},r),c=e=>(t,r)=>e.transporter.write({method:o.N.Delete,path:(0,s.encode)("2/abtests/%s",t)},r),d=e=>(t,r)=>e.transporter.read({method:o.N.Get,path:(0,s.encode)("2/abtests/%s",t)},r),l=e=>t=>e.transporter.read({method:o.N.Get,path:"2/abtests"},t),u=e=>(t,r)=>e.transporter.write({method:o.N.Post,path:(0,s.encode)("2/abtests/%s/stop",t)},r)},757:(e,t,r)=>{"use strict";function s(e,t,r){const s={"x-algolia-api-key":r,"x-algolia-application-id":t};return{headers:()=>e===u.WithinHeaders?s:{},queryParameters:()=>e===u.WithinQueryParameters?s:{}}}function a(e){let t=0;const r=()=>(t++,new Promise(s=>{setTimeout(()=>{s(e(r))},Math.min(100*t,1e3))}));return e(r)}function o(e,t=((e,t)=>Promise.resolve())){return Object.assign(e,{wait:r=>o(e.then(e=>Promise.all([t(e,r),e])).then(e=>e[1]))})}function n(e){let t=e.length-1;for(;t>0;t--){const r=Math.floor(Math.random()*(t+1)),s=e[t];e[t]=e[r],e[r]=s}return e}function i(e,t){return Object.keys(void 0!==t?t:{}).forEach(r=>{e[r]=t[r](e)}),e}function c(e,...t){let r=0;return e.replace(/%s/g,()=>encodeURIComponent(t[r++]))}r.r(t),r.d(t,{AuthMode:()=>u,addMethods:()=>i,createAuth:()=>s,createRetryablePromise:()=>a,createWaitablePromise:()=>o,destroy:()=>l,encode:()=>c,shuffle:()=>n,version:()=>d});const d="4.2.0",l=e=>()=>e.transporter.requester.destroy(),u={WithinQueryParameters:0,WithinHeaders:1}},103:(e,t,r)=>{"use strict";r.r(t),r.d(t,{createRecommendationClient:()=>n,getPersonalizationStrategy:()=>i,setPersonalizationStrategy:()=>c});var s=r(757),a=r(858),o=r(541);const n=e=>{const t=e.region||"us",r=(0,s.createAuth)(s.AuthMode.WithinHeaders,e.appId,e.apiKey),o=(0,a.createTransporter)({hosts:[{url:`recommendation.${t}.algolia.com`}],...e,headers:{...r.headers(),"content-type":"application/json",...e.headers},queryParameters:{...r.queryParameters(),...e.queryParameters}});return(0,s.addMethods)({appId:e.appId,transporter:o},e.methods)},i=e=>t=>e.transporter.read({method:o.N.Get,path:"1/strategies/personalization"},t),c=e=>(t,r)=>e.transporter.write({method:o.N.Post,path:"1/strategies/personalization",data:t},r)},586:(e,t,r)=>{"use strict";r.r(t),r.d(t,{ApiKeyACLEnum:()=>De,BatchActionEnum:()=>we,ScopeEnum:()=>Ae,StrategyEnum:()=>qe,SynonymEnum:()=>Re,addApiKey:()=>p,assignUserID:()=>m,assignUserIDs:()=>h,batch:()=>H,browseObjects:()=>K,browseRules:()=>B,browseSynonyms:()=>z,chunkedBatch:()=>V,clearObjects:()=>$,clearRules:()=>L,clearSynonyms:()=>Q,copyIndex:()=>y,copyRules:()=>g,copySettings:()=>b,copySynonyms:()=>f,createBrowsablePromise:()=>i,createMissingObjectIDError:()=>d,createObjectNotFoundError:()=>l,createSearchClient:()=>c,createValidUntilNotFoundError:()=>u,deleteApiKey:()=>P,deleteBy:()=>J,deleteIndex:()=>_,deleteObject:()=>X,deleteObjects:()=>Y,deleteRule:()=>Z,deleteSynonym:()=>ee,exists:()=>te,findObject:()=>re,generateSecuredApiKey:()=>I,getApiKey:()=>O,getLogs:()=>j,getObject:()=>se,getObjectPosition:()=>ae,getObjects:()=>oe,getRule:()=>ne,getSecuredApiKeyRemainingValidity:()=>v,getSettings:()=>ie,getSynonym:()=>ce,getTask:()=>de,getTopUserIDs:()=>N,getUserID:()=>x,hasPendingMappings:()=>S,initIndex:()=>D,listApiKeys:()=>w,listClusters:()=>A,listIndices:()=>q,listUserIDs:()=>R,moveIndex:()=>T,multipleBatch:()=>k,multipleGetObjects:()=>U,multipleQueries:()=>C,multipleSearchForFacetValues:()=>E,partialUpdateObject:()=>le,partialUpdateObjects:()=>ue,removeUserID:()=>M,replaceAllObjects:()=>pe,replaceAllRules:()=>me,replaceAllSynonyms:()=>he,restoreApiKey:()=>W,saveObject:()=>ye,saveObjects:()=>ge,saveRule:()=>be,saveRules:()=>fe,saveSynonym:()=>Pe,saveSynonyms:()=>Ie,search:()=>Oe,searchForFacetValues:()=>je,searchRules:()=>ve,searchSynonyms:()=>Ne,searchUserIDs:()=>F,setSettings:()=>xe,updateApiKey:()=>G,waitTask:()=>Se});var s=r(757),a=r(858),o=r(541),n=r(417);function i(e){const t=r=>e.request(r).then(s=>{if(void 0!==e.batch&&e.batch(s.hits),!e.shouldStop(s))return s.cursor?t({cursor:s.cursor}):t({page:(r.page||0)+1})});return t({})}const c=e=>{const t=e.appId,r=(0,s.createAuth)(void 0!==e.authMode?e.authMode:s.AuthMode.WithinHeaders,t,e.apiKey),o=(0,a.createTransporter)({hosts:[{url:t+"-dsn.algolia.net",accept:a.CallEnum.Read},{url:t+".algolia.net",accept:a.CallEnum.Write}].concat((0,s.shuffle)([{url:t+"-1.algolianet.com"},{url:t+"-2.algolianet.com"},{url:t+"-3.algolianet.com"}])),...e,headers:{...r.headers(),"content-type":"application/x-www-form-urlencoded",...e.headers},queryParameters:{...r.queryParameters(),...e.queryParameters}}),n={transporter:o,appId:t,addAlgoliaAgent(e,t){o.userAgent.add({segment:e,version:t})},clearCache:()=>Promise.all([o.requestsCache.clear(),o.responsesCache.clear()]).then(()=>{})};return(0,s.addMethods)(n,e.methods)};function d(){return{name:"MissingObjectIDError",message:"All objects must have an unique objectID (like a primary key) to be valid. Algolia is also able to generate objectIDs automatically but *it's not recommended*. To do it, use the `{'autoGenerateObjectIDIfNotExist': true}` option."}}function l(){return{name:"ObjectNotFoundError",message:"Object not found."}}function u(){return{name:"ValidUntilNotFoundError",message:"ValidUntil not found in given secured api key."}}const p=e=>(t,r)=>{const{queryParameters:a,...n}=r||{},i={acl:t,...void 0!==a?{queryParameters:a}:{}};return(0,s.createWaitablePromise)(e.transporter.write({method:o.N.Post,path:"1/keys",data:i},n),(t,r)=>(0,s.createRetryablePromise)(s=>O(e)(t.key,r).catch(e=>{if(404!==e.status)throw e;return s()})))},m=e=>(t,r,s)=>{const n=(0,a.createMappedRequestOptions)(s);return n.queryParameters["X-Algolia-User-ID"]=t,e.transporter.write({method:o.N.Post,path:"1/clusters/mapping",data:{cluster:r}},n)},h=e=>(t,r,s)=>e.transporter.write({method:o.N.Post,path:"1/clusters/mapping/batch",data:{users:t,cluster:r}},s),y=e=>(t,r,a)=>(0,s.createWaitablePromise)(e.transporter.write({method:o.N.Post,path:(0,s.encode)("1/indexes/%s/operation",t),data:{operation:"copy",destination:r}},a),(r,s)=>D(e)(t,{methods:{waitTask:Se}}).waitTask(r.taskID,s)),g=e=>(t,r,s)=>y(e)(t,r,{...s,scope:[Ae.Rules]}),b=e=>(t,r,s)=>y(e)(t,r,{...s,scope:[Ae.Settings]}),f=e=>(t,r,s)=>y(e)(t,r,{...s,scope:[Ae.Synonyms]}),P=e=>(t,r)=>(0,s.createWaitablePromise)(e.transporter.write({method:o.N.Delete,path:(0,s.encode)("1/keys/%s",t)},r),(r,a)=>(0,s.createRetryablePromise)(r=>O(e)(t,a).then(r).catch(e=>{if(404!==e.status)throw e}))),I=()=>(e,t)=>{const r=(0,a.serializeQueryParameters)(t),s=(0,n.createHmac)("sha256",e).update(r).digest("hex");return Buffer.from(s+r).toString("base64")},O=e=>(t,r)=>e.transporter.read({method:o.N.Get,path:(0,s.encode)("1/keys/%s",t)},r),j=e=>t=>e.transporter.read({method:o.N.Get,path:"1/logs"},t),v=()=>e=>{const t=Buffer.from(e,"base64").toString("ascii").match(/validUntil=(\d+)/);if(null===t)throw{name:"ValidUntilNotFoundError",message:"ValidUntil not found in given secured api key."};return parseInt(t[1],10)-Math.round((new Date).getTime()/1e3)},N=e=>t=>e.transporter.read({method:o.N.Get,path:"1/clusters/mapping/top"},t),x=e=>(t,r)=>e.transporter.read({method:o.N.Get,path:(0,s.encode)("1/clusters/mapping/%s",t)},r),S=e=>t=>{const{retrieveMappings:r,...s}=t||{};return!0===r&&(s.getClusters=!0),e.transporter.read({method:o.N.Get,path:"1/clusters/mapping/pending"},s)},D=e=>(t,r={})=>{const a={transporter:e.transporter,appId:e.appId,indexName:t};return(0,s.addMethods)(a,r.methods)},w=e=>t=>e.transporter.read({method:o.N.Get,path:"1/keys"},t),A=e=>t=>e.transporter.read({method:o.N.Get,path:"1/clusters"},t),q=e=>t=>e.transporter.read({method:o.N.Get,path:"1/indexes"},t),R=e=>t=>e.transporter.read({method:o.N.Get,path:"1/clusters/mapping"},t),T=e=>(t,r,a)=>(0,s.createWaitablePromise)(e.transporter.write({method:o.N.Post,path:(0,s.encode)("1/indexes/%s/operation",t),data:{operation:"move",destination:r}},a),(r,s)=>D(e)(t,{methods:{waitTask:Se}}).waitTask(r.taskID,s)),k=e=>(t,r)=>(0,s.createWaitablePromise)(e.transporter.write({method:o.N.Post,path:"1/indexes/*/batch",data:{requests:t}},r),(t,r)=>Promise.all(Object.keys(t.taskID).map(s=>D(e)(s,{methods:{waitTask:Se}}).waitTask(t.taskID[s],r)))),U=e=>(t,r)=>e.transporter.read({method:o.N.Post,path:"1/indexes/*/objects",data:{requests:t}},r),C=e=>(t,r)=>{const s=t.map(e=>({...e,params:(0,a.serializeQueryParameters)(e.params||{})}));return e.transporter.read({method:o.N.Post,path:"1/indexes/*/queries",data:{requests:s},cacheable:!0},r)},E=e=>(t,r)=>Promise.all(t.map(t=>{const{facetName:s,facetQuery:a,...o}=t.params;return D(e)(t.indexName,{methods:{searchForFacetValues:je}}).searchForFacetValues(s,a,{...r,...o})})),M=e=>(t,r)=>{const s=(0,a.createMappedRequestOptions)(r);return s.queryParameters["X-Algolia-User-ID"]=t,e.transporter.write({method:o.N.Delete,path:"1/clusters/mapping"},s)},W=e=>(t,r)=>(0,s.createWaitablePromise)(e.transporter.write({method:o.N.Post,path:(0,s.encode)("1/keys/%s/restore",t)},r),(r,a)=>(0,s.createRetryablePromise)(r=>O(e)(t,a).catch(e=>{if(404!==e.status)throw e;return r()}))),F=e=>(t,r)=>e.transporter.read({method:o.N.Post,path:"1/clusters/mapping/search",data:{query:t}},r),G=e=>(t,r)=>{const a=Object.assign({},r),{queryParameters:n,...i}=r||{},c=n?{queryParameters:n}:{},d=["acl","indexes","referers","restrictSources","queryParameters","description","maxQueriesPerIPPerHour","maxHitsPerQuery"];return(0,s.createWaitablePromise)(e.transporter.write({method:o.N.Put,path:(0,s.encode)("1/keys/%s",t),data:c},i),(r,o)=>(0,s.createRetryablePromise)(r=>O(e)(t,o).then(e=>(e=>Object.keys(a).filter(e=>-1!==d.indexOf(e)).every(t=>e[t]===a[t]))(e)?Promise.resolve():r())))},H=e=>(t,r)=>(0,s.createWaitablePromise)(e.transporter.write({method:o.N.Post,path:(0,s.encode)("1/indexes/%s/batch",e.indexName),data:{requests:t}},r),(t,r)=>Se(e)(t.taskID,r)),K=e=>t=>i({...t,shouldStop:e=>void 0===e.cursor,request:r=>e.transporter.read({method:o.N.Post,path:(0,s.encode)("1/indexes/%s/browse",e.indexName),data:r},t)}),B=e=>t=>{const r={hitsPerPage:1e3,...t};return i({...r,shouldStop:e=>e.hits.lengthve(e)("",{...r,...t}).then(e=>({...e,hits:e.hits.map(e=>(delete e._highlightResult,e))}))})},z=e=>t=>{const r={hitsPerPage:1e3,...t};return i({...r,shouldStop:e=>e.hits.lengthNe(e)("",{...r,...t}).then(e=>({...e,hits:e.hits.map(e=>(delete e._highlightResult,e))}))})},V=e=>(t,r,a)=>{const{batchSize:o,...n}=a||{},i={taskIDs:[],objectIDs:[]},c=(s=0)=>{const a=[];let d;for(d=s;d({action:r,body:e})),n).then(e=>(i.objectIDs=i.objectIDs.concat(e.objectIDs),i.taskIDs.push(e.taskID),d++,c(d)))};return(0,s.createWaitablePromise)(c(),(t,r)=>Promise.all(t.taskIDs.map(t=>Se(e)(t,r))))},$=e=>t=>(0,s.createWaitablePromise)(e.transporter.write({method:o.N.Post,path:(0,s.encode)("1/indexes/%s/clear",e.indexName)},t),(t,r)=>Se(e)(t.taskID,r)),L=e=>t=>{const{forwardToReplicas:r,...n}=t||{},i=(0,a.createMappedRequestOptions)(n);return r&&(i.queryParameters.forwardToReplicas=1),(0,s.createWaitablePromise)(e.transporter.write({method:o.N.Post,path:(0,s.encode)("1/indexes/%s/rules/clear",e.indexName)},i),(t,r)=>Se(e)(t.taskID,r))},Q=e=>t=>{const{forwardToReplicas:r,...n}=t||{},i=(0,a.createMappedRequestOptions)(n);return r&&(i.queryParameters.forwardToReplicas=1),(0,s.createWaitablePromise)(e.transporter.write({method:o.N.Post,path:(0,s.encode)("1/indexes/%s/synonyms/clear",e.indexName)},i),(t,r)=>Se(e)(t.taskID,r))},J=e=>(t,r)=>(0,s.createWaitablePromise)(e.transporter.write({method:o.N.Post,path:(0,s.encode)("1/indexes/%s/deleteByQuery",e.indexName),data:t},r),(t,r)=>Se(e)(t.taskID,r)),_=e=>t=>(0,s.createWaitablePromise)(e.transporter.write({method:o.N.Delete,path:(0,s.encode)("1/indexes/%s",e.indexName)},t),(t,r)=>Se(e)(t.taskID,r)),X=e=>(t,r)=>(0,s.createWaitablePromise)(Y(e)([t],r).then(e=>({taskID:e.taskIDs[0]})),(t,r)=>Se(e)(t.taskID,r)),Y=e=>(t,r)=>{const s=t.map(e=>({objectID:e}));return V(e)(s,we.DeleteObject,r)},Z=e=>(t,r)=>{const{forwardToReplicas:n,...i}=r||{},c=(0,a.createMappedRequestOptions)(i);return n&&(c.queryParameters.forwardToReplicas=1),(0,s.createWaitablePromise)(e.transporter.write({method:o.N.Delete,path:(0,s.encode)("1/indexes/%s/rules/%s",e.indexName,t)},c),(t,r)=>Se(e)(t.taskID,r))},ee=e=>(t,r)=>{const{forwardToReplicas:n,...i}=r||{},c=(0,a.createMappedRequestOptions)(i);return n&&(c.queryParameters.forwardToReplicas=1),(0,s.createWaitablePromise)(e.transporter.write({method:o.N.Delete,path:(0,s.encode)("1/indexes/%s/synonyms/%s",e.indexName,t)},c),(t,r)=>Se(e)(t.taskID,r))},te=e=>t=>ie(e)(t).then(()=>!0).catch(e=>{if(404!==e.status)throw e;return!1}),re=e=>(t,r)=>{const{query:s,paginate:a,...o}=r||{};let n=0;const i=()=>Oe(e)(s||"",{...o,page:n}).then(e=>{for(const[r,s]of Object.entries(e.hits))if(t(s))return{object:s,position:parseInt(r,10),page:n};if(n++,!1===a||n>=e.nbPages)throw{name:"ObjectNotFoundError",message:"Object not found."};return i()});return i()},se=e=>(t,r)=>e.transporter.read({method:o.N.Get,path:(0,s.encode)("1/indexes/%s/%s",e.indexName,t)},r),ae=()=>(e,t)=>{for(const[r,s]of Object.entries(e.hits))if(s.objectID===t)return parseInt(r,10);return-1},oe=e=>(t,r)=>{const{attributesToRetrieve:s,...a}=r||{},n=t.map(t=>({indexName:e.indexName,objectID:t,...s?{attributesToRetrieve:s}:{}}));return e.transporter.read({method:o.N.Post,path:"1/indexes/*/objects",data:{requests:n}},a)},ne=e=>(t,r)=>e.transporter.read({method:o.N.Get,path:(0,s.encode)("1/indexes/%s/rules/%s",e.indexName,t)},r),ie=e=>t=>e.transporter.read({method:o.N.Get,path:(0,s.encode)("1/indexes/%s/settings",e.indexName),data:{getVersion:2}},t),ce=e=>(t,r)=>e.transporter.read({method:o.N.Get,path:(0,s.encode)("1/indexes/%s/synonyms/%s",e.indexName,t)},r),de=e=>(t,r)=>e.transporter.read({method:o.N.Get,path:(0,s.encode)("1/indexes/%s/task/%s",e.indexName,t.toString())},r),le=e=>(t,r)=>(0,s.createWaitablePromise)(ue(e)([t],r).then(e=>({objectID:e.objectIDs[0],taskID:e.taskIDs[0]})),(t,r)=>Se(e)(t.taskID,r)),ue=e=>(t,r)=>{const{createIfNotExists:s,...a}=r||{},o=s?we.PartialUpdateObject:we.PartialUpdateObjectNoCreate;return V(e)(t,o,a)},pe=e=>(t,r)=>{const{safe:a,autoGenerateObjectIDIfNotExist:n,batchSize:i,...c}=r||{},d=(t,r,a,n)=>(0,s.createWaitablePromise)(e.transporter.write({method:o.N.Post,path:(0,s.encode)("1/indexes/%s/operation",t),data:{operation:a,destination:r}},n),(t,r)=>Se(e)(t.taskID,r)),l=Math.random().toString(36).substring(7),u=`${e.indexName}_tmp_${l}`,p=ge({appId:e.appId,transporter:e.transporter,indexName:u});let m=[];const h=d(e.indexName,u,"copy",{...c,scope:["settings","synonyms","rules"]});m.push(h);const y=(a?h.wait(c):h).then(()=>{const e=p(t,{...c,autoGenerateObjectIDIfNotExist:n,batchSize:i});return m.push(e),a?e.wait(c):e}).then(()=>{const t=d(u,e.indexName,"move",c);return m.push(t),a?t.wait(c):t}).then(()=>Promise.all(m)).then(([e,t,r])=>({objectIDs:t.objectIDs,taskIDs:[e.taskID,...t.taskIDs,r.taskID]}));return(0,s.createWaitablePromise)(y,(e,t)=>Promise.all(m.map(e=>e.wait(t))))},me=e=>(t,r)=>fe(e)(t,{...r,clearExistingRules:!0}),he=e=>(t,r)=>Ie(e)(t,{...r,replaceExistingSynonyms:!0}),ye=e=>(t,r)=>(0,s.createWaitablePromise)(ge(e)([t],r).then(e=>({objectID:e.objectIDs[0],taskID:e.taskIDs[0]})),(t,r)=>Se(e)(t.taskID,r)),ge=e=>(t,r)=>{const{autoGenerateObjectIDIfNotExist:a,...o}=r||{},n=a?we.AddObject:we.UpdateObject;if(n===we.UpdateObject)for(const e of t)if(void 0===e.objectID)return(0,s.createWaitablePromise)(Promise.reject({name:"MissingObjectIDError",message:"All objects must have an unique objectID (like a primary key) to be valid. Algolia is also able to generate objectIDs automatically but *it's not recommended*. To do it, use the `{'autoGenerateObjectIDIfNotExist': true}` option."}));return V(e)(t,n,o)},be=e=>(t,r)=>fe(e)([t],r),fe=e=>(t,r)=>{const{forwardToReplicas:n,clearExistingRules:i,...c}=r||{},d=(0,a.createMappedRequestOptions)(c);return n&&(d.queryParameters.forwardToReplicas=1),i&&(d.queryParameters.clearExistingRules=1),(0,s.createWaitablePromise)(e.transporter.write({method:o.N.Post,path:(0,s.encode)("1/indexes/%s/rules/batch",e.indexName),data:t},d),(t,r)=>Se(e)(t.taskID,r))},Pe=e=>(t,r)=>Ie(e)([t],r),Ie=e=>(t,r)=>{const{forwardToReplicas:n,replaceExistingSynonyms:i,...c}=r||{},d=(0,a.createMappedRequestOptions)(c);return n&&(d.queryParameters.forwardToReplicas=1),i&&(d.queryParameters.replaceExistingSynonyms=1),(0,s.createWaitablePromise)(e.transporter.write({method:o.N.Post,path:(0,s.encode)("1/indexes/%s/synonyms/batch",e.indexName),data:t},d),(t,r)=>Se(e)(t.taskID,r))},Oe=e=>(t,r)=>e.transporter.read({method:o.N.Post,path:(0,s.encode)("1/indexes/%s/query",e.indexName),data:{query:t},cacheable:!0},r),je=e=>(t,r,a)=>e.transporter.read({method:o.N.Post,path:(0,s.encode)("1/indexes/%s/facets/%s/query",e.indexName,t),data:{facetQuery:r},cacheable:!0},a),ve=e=>(t,r)=>e.transporter.read({method:o.N.Post,path:(0,s.encode)("1/indexes/%s/rules/search",e.indexName),data:{query:t}},r),Ne=e=>(t,r)=>e.transporter.read({method:o.N.Post,path:(0,s.encode)("1/indexes/%s/synonyms/search",e.indexName),data:{query:t}},r),xe=e=>(t,r)=>{const{forwardToReplicas:n,...i}=r||{},c=(0,a.createMappedRequestOptions)(i);return n&&(c.queryParameters.forwardToReplicas=1),(0,s.createWaitablePromise)(e.transporter.write({method:o.N.Put,path:(0,s.encode)("1/indexes/%s/settings",e.indexName),data:t},c),(t,r)=>Se(e)(t.taskID,r))},Se=e=>(t,r)=>(0,s.createRetryablePromise)(s=>de(e)(t,r).then(e=>"published"!==e.status?s():void 0)),De={AddObject:"addObject",Analytics:"analytics",Browser:"browse",DeleteIndex:"deleteIndex",DeleteObject:"deleteObject",EditSettings:"editSettings",ListIndexes:"listIndexes",Logs:"logs",Recommendation:"recommendation",Search:"search",SeeUnretrievableAttributes:"seeUnretrievableAttributes",Settings:"settings",Usage:"usage"},we={AddObject:"addObject",UpdateObject:"updateObject",PartialUpdateObject:"partialUpdateObject",PartialUpdateObjectNoCreate:"partialUpdateObjectNoCreate",DeleteObject:"deleteObject"},Ae={Settings:"settings",Synonyms:"synonyms",Rules:"rules"},qe={None:"none",StopIfEnoughMatches:"stopIfEnoughMatches"},Re={Synonym:"synonym",OneWaySynonym:"oneWaySynonym",AltCorrection1:"altCorrection1",AltCorrection2:"altCorrection2",Placeholder:"placeholder"}},45:(e,t,r)=>{"use strict";function s(){return{debug:(e,t)=>Promise.resolve(),info:(e,t)=>Promise.resolve(),error:(e,t)=>Promise.resolve()}}r.r(t),r.d(t,{LogLevelEnum:()=>a,createNullLogger:()=>s});const a={Debug:1,Info:2,Error:3}},541:(e,t,r)=>{"use strict";r.d(t,{N:()=>s});const s={Delete:"DELETE",Get:"GET",Post:"POST",Put:"PUT"}},178:(e,t,r)=>{"use strict";r.r(t),r.d(t,{createNodeHttpRequester:()=>n});var s=r(605),a=r(211),o=r(835);function n(){const e={keepAlive:!0},t=new s.Agent(e),r=new a.Agent(e);return{send:e=>new Promise(n=>{const i=(0,o.parse)(e.url),c=null===i.query?i.pathname:`${i.pathname}?${i.query}`,d={agent:"https:"===i.protocol?r:t,hostname:i.hostname,path:c,method:e.method,headers:e.headers,...void 0!==i.port?{port:i.port||""}:{}},l=("https:"===i.protocol?a:s).request(d,e=>{let t="";e.on("data",e=>t+=e),e.on("end",()=>{clearTimeout(p),clearTimeout(m),n({status:e.statusCode||0,content:t,isTimedOut:!1})})}),u=(e,t)=>setTimeout(()=>{l.abort(),n({status:0,content:t,isTimedOut:!0})},1e3*e),p=u(e.connectTimeout,"Connection timeout");let m;l.on("error",e=>{clearTimeout(p),clearTimeout(m),n({status:0,content:e.message,isTimedOut:!1})}),l.once("response",()=>{clearTimeout(p),m=u(e.responseTimeout,"Socket timeout")}),void 0!==e.data&&l.write(e.data),l.end()}),destroy:()=>(t.destroy(),r.destroy(),Promise.resolve())}}},858:(e,t,r)=>{"use strict";r.r(t),r.d(t,{CallEnum:()=>o,HostStatusEnum:()=>n,createApiError:()=>j,createDeserializationError:()=>v,createMappedRequestOptions:()=>a,createRetryError:()=>N,createStatefulHost:()=>i,createStatelessHost:()=>l,createTransporter:()=>p,createUserAgent:()=>m,deserializeFailure:()=>y,deserializeSuccess:()=>h,isStatefulHostTimeouted:()=>d,isStatefulHostUp:()=>c,serializeData:()=>f,serializeHeaders:()=>P,serializeQueryParameters:()=>b,serializeUrl:()=>g,stackFrameWithoutCredentials:()=>O,stackTraceWithoutCredentials:()=>I});var s=r(541);function a(e,t){const r=e||{},s=r.data||{};return Object.keys(r).forEach(e=>{-1===["timeout","headers","queryParameters","data","cacheable"].indexOf(e)&&(s[e]=r[e])}),{data:Object.entries(s).length>0?s:void 0,timeout:r.timeout||t,headers:r.headers||{},queryParameters:r.queryParameters||{},cacheable:r.cacheable}}const o={Read:1,Write:2,Any:3},n={Up:1,Down:2,Timeouted:3};function i(e,t=n.Up){return{...e,status:t,lastUpdate:Date.now()}}function c(e){return e.status===n.Up||Date.now()-e.lastUpdate>12e4}function d(e){return e.status===n.Timeouted&&Date.now()-e.lastUpdate<=12e4}function l(e){return{protocol:e.protocol||"https",url:e.url,accept:e.accept||o.Any}}function u(e,t,r,a){const o=[],u=f(r,a),p=P(e,a),m=r.method,b=r.method!==s.N.Get?{}:{...r.data,...a.data},j={"x-algolia-agent":e.userAgent.value,...e.queryParameters,...b,...a.queryParameters};let v=0;const x=(t,s)=>{const c=t.pop();if(void 0===c)throw N(I(o));const d={data:u,headers:p,method:m,url:g(c,r.path,j),connectTimeout:s(v,e.timeouts.connect),responseTimeout:s(v,a.timeout)},l=e=>{const r={request:d,response:e,host:c,triesLeft:t.length};return o.push(r),r},b={onSucess:e=>h(e),onRetry(r){const a=l(r);return r.isTimedOut&&v++,Promise.all([e.logger.info("Retryable failure",O(a)),e.hostsCache.set(c,i(c,r.isTimedOut?n.Timeouted:n.Down))]).then(()=>x(t,s))},onFail(e){throw l(e),y(e,I(o))}};return e.requester.send(d).then(e=>((e,t)=>(e=>{const t=e.status;return e.isTimedOut||(({isTimedOut:e,status:t})=>!e&&0==~~t)(e)||2!=~~(t/100)&&4!=~~(t/100)})(e)?t.onRetry(e):(({status:e})=>2==~~(e/100))(e)?t.onSucess(e):t.onFail(e))(e,b))};return function(e,t){return Promise.all(t.map(t=>e.get(t,()=>Promise.resolve(i(t))))).then(e=>{const r=e.filter(e=>c(e)),s=e.filter(e=>d(e)),a=[...r,...s];return{getTimeout:(e,t)=>(0===s.length&&0===e?1:s.length+3+e)*t,statelessHosts:a.length>0?a.map(e=>l(e)):t}})}(e.hostsCache,t).then(e=>x([...e.statelessHosts].reverse(),e.getTimeout))}function p(e){const{hostsCache:t,logger:r,requester:s,requestsCache:n,responsesCache:i,timeouts:c,userAgent:d,hosts:p,queryParameters:m,headers:h}=e,y={hostsCache:t,logger:r,requester:s,requestsCache:n,responsesCache:i,timeouts:c,userAgent:d,headers:h,queryParameters:m,hosts:p.map(e=>l(e)),read(e,t){const r=a(t,y.timeouts.read),s=()=>u(y,y.hosts.filter(e=>0!=(e.accept&o.Read)),e,r);if(!0!==(void 0!==r.cacheable?r.cacheable:e.cacheable))return s();const n={request:e,mappedRequestOptions:r,transporter:{queryParameters:y.queryParameters,headers:y.headers}};return y.responsesCache.get(n,()=>y.requestsCache.get(n,()=>y.requestsCache.set(n,s()).then(e=>Promise.all([y.requestsCache.delete(n),e]),e=>Promise.all([y.requestsCache.delete(n),Promise.reject(e)])).then(([e,t])=>t)),{miss:e=>y.responsesCache.set(n,e)})},write:(e,t)=>u(y,y.hosts.filter(e=>0!=(e.accept&o.Write)),e,a(t,y.timeouts.write))};return y}function m(e){const t={value:`Algolia for JavaScript (${e})`,add(e){const r=`; ${e.segment}${void 0!==e.version?` (${e.version})`:""}`;return-1===t.value.indexOf(r)&&(t.value=`${t.value}${r}`),t}};return t}function h(e){try{return JSON.parse(e.content)}catch(t){throw v(t.message,e)}}function y({content:e,status:t},r){let s=e;try{s=JSON.parse(e).message}catch(e){}return j(s,t,r)}function g(e,t,r){const s=b(r);let a=`${e.protocol}://${e.url}/${"/"===t.charAt(0)?t.substr(1):t}`;return s.length&&(a+="?"+s),a}function b(e){return Object.keys(e).map(t=>{return function(e,...t){let r=0;return e.replace(/%s/g,()=>encodeURIComponent(t[r++]))}("%s=%s",t,(r=e[t],"[object Object]"===Object.prototype.toString.call(r)||"[object Array]"===Object.prototype.toString.call(r)?JSON.stringify(e[t]):e[t]));var r}).join("&")}function f(e,t){if(e.method===s.N.Get||void 0===e.data&&void 0===t.data)return;const r=Array.isArray(e.data)?e.data:{...e.data,...t.data};return JSON.stringify(r)}function P(e,t){const r={...e.headers,...t.headers},s={};return Object.keys(r).forEach(e=>{const t=r[e];s[e.toLowerCase()]=t}),s}function I(e){return e.map(e=>O(e))}function O(e){const t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...e,request:{...e.request,headers:{...e.request.headers,...t}}}}function j(e,t,r){return{name:"ApiError",message:e,status:t,transporterStackTrace:r}}function v(e,t){return{name:"DeserializationError",message:e,response:t}}function N(e){return{name:"RetryError",message:"Unreachable hosts - your application id may be incorrect. If the error persists, contact support@algolia.com.",transporterStackTrace:e}}},774:(e,t,r)=>{"use strict";var s=r(469),a=r(712),o=r(223),n=r(757),i=r(103),c=r(586),d=r(45),l=r(178),u=r(858);function p(e,t,r){const p={appId:e,apiKey:t,timeouts:{connect:2,read:5,write:30},requester:l.createNodeHttpRequester(),logger:d.createNullLogger(),responsesCache:s.createNullCache(),requestsCache:s.createNullCache(),hostsCache:a.createInMemoryCache(),userAgent:u.createUserAgent(n.version).add({segment:"Node.js",version:process.versions.node})};return c.createSearchClient({...p,...r,methods:{search:c.multipleQueries,searchForFacetValues:c.multipleSearchForFacetValues,multipleBatch:c.multipleBatch,multipleGetObjects:c.multipleGetObjects,multipleQueries:c.multipleQueries,copyIndex:c.copyIndex,copySettings:c.copySettings,copyRules:c.copyRules,copySynonyms:c.copySynonyms,moveIndex:c.moveIndex,listIndices:c.listIndices,getLogs:c.getLogs,listClusters:c.listClusters,multipleSearchForFacetValues:c.multipleSearchForFacetValues,getApiKey:c.getApiKey,addApiKey:c.addApiKey,listApiKeys:c.listApiKeys,updateApiKey:c.updateApiKey,deleteApiKey:c.deleteApiKey,restoreApiKey:c.restoreApiKey,assignUserID:c.assignUserID,assignUserIDs:c.assignUserIDs,getUserID:c.getUserID,searchUserIDs:c.searchUserIDs,listUserIDs:c.listUserIDs,getTopUserIDs:c.getTopUserIDs,removeUserID:c.removeUserID,hasPendingMappings:c.hasPendingMappings,generateSecuredApiKey:c.generateSecuredApiKey,getSecuredApiKeyRemainingValidity:c.getSecuredApiKeyRemainingValidity,destroy:n.destroy,initIndex:e=>t=>c.initIndex(e)(t,{methods:{batch:c.batch,delete:c.deleteIndex,getObject:c.getObject,getObjects:c.getObjects,saveObject:c.saveObject,saveObjects:c.saveObjects,search:c.search,searchForFacetValues:c.searchForFacetValues,waitTask:c.waitTask,setSettings:c.setSettings,getSettings:c.getSettings,partialUpdateObject:c.partialUpdateObject,partialUpdateObjects:c.partialUpdateObjects,deleteObject:c.deleteObject,deleteObjects:c.deleteObjects,deleteBy:c.deleteBy,clearObjects:c.clearObjects,browseObjects:c.browseObjects,getObjectPosition:c.getObjectPosition,findObject:c.findObject,exists:c.exists,saveSynonym:c.saveSynonym,saveSynonyms:c.saveSynonyms,getSynonym:c.getSynonym,searchSynonyms:c.searchSynonyms,browseSynonyms:c.browseSynonyms,deleteSynonym:c.deleteSynonym,clearSynonyms:c.clearSynonyms,replaceAllObjects:c.replaceAllObjects,replaceAllSynonyms:c.replaceAllSynonyms,searchRules:c.searchRules,getRule:c.getRule,deleteRule:c.deleteRule,saveRule:c.saveRule,saveRules:c.saveRules,replaceAllRules:c.replaceAllRules,browseRules:c.browseRules,clearRules:c.clearRules}}),initAnalytics:()=>e=>o.createAnalyticsClient({...p,...e,methods:{addABTest:o.addABTest,getABTest:o.getABTest,getABTests:o.getABTests,stopABTest:o.stopABTest,deleteABTest:o.deleteABTest}}),initRecommendation:()=>e=>i.createRecommendationClient({...p,...e,methods:{getPersonalizationStrategy:i.getPersonalizationStrategy,setPersonalizationStrategy:i.setPersonalizationStrategy}})}})}p.version=n.version,e.exports=p},410:(e,t,r)=>{const s=r(774);e.exports=s,e.exports.default=s},966:e=>{"use strict";e.exports=require("@yarnpkg/core")},850:e=>{"use strict";e.exports=require("@yarnpkg/plugin-essentials")},417:e=>{"use strict";e.exports=require("crypto")},605:e=>{"use strict";e.exports=require("http")},211:e=>{"use strict";e.exports=require("https")},513:e=>{"use strict";e.exports=require("semver")},835:e=>{"use strict";e.exports=require("url")}},t={};function r(s){if(t[s])return t[s].exports;var a=t[s]={exports:{}};return e[s](a,a.exports,r),a.exports}return r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var s in t)r.o(t,s)&&!r.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r(948)})(); 6 | return plugin; 7 | } 8 | }; -------------------------------------------------------------------------------- /.yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | module.exports = { 3 | name: "@yarnpkg/plugin-workspace-tools", 4 | factory: function (require) { 5 | var plugin;plugin=(()=>{"use strict";var e={115:(e,t,n)=>{n.r(t),n.d(t,{default:()=>y});function o(e,t,n,o){var r,a=arguments.length,s=a<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,o);else for(var i=e.length-1;i>=0;i--)(r=e[i])&&(s=(a<3?r(s):a>3?r(t,n,s):r(t,n))||s);return a>3&&s&&Object.defineProperty(t,n,s),s}var r=n(594),a=n(966),s=n(42),i=n(440);class l extends r.BaseCommand{constructor(){super(...arguments),this.workspaces=[],this.json=!1,this.production=!1,this.all=!1}async execute(){const e=await a.Configuration.find(this.context.cwd,this.context.plugins),{project:t,workspace:n}=await a.Project.find(e,this.context.cwd),o=await a.Cache.find(e);let s;if(this.all)s=new Set(t.workspaces);else if(0===this.workspaces.length){if(!n)throw new r.WorkspaceRequiredError(t.cwd,this.context.cwd);s=new Set([n])}else s=new Set(this.workspaces.map(e=>t.getWorkspaceByIdent(a.structUtils.parseIdent(e))));for(const e of s)for(const n of a.Manifest.hardDependencies)for(const o of e.manifest.getForScope(n).values()){const e=t.tryWorkspaceByDescriptor(o);null!==e&&s.add(e)}for(const e of t.workspaces)s.has(e)?this.production&&e.manifest.devDependencies.clear():(e.manifest.dependencies.clear(),e.manifest.devDependencies.clear(),e.manifest.peerDependencies.clear());return(await a.StreamReport.start({configuration:e,json:this.json,stdout:this.context.stdout,includeLogs:!0},async e=>{await t.install({cache:o,report:e,persistProject:!1}),await t.persistInstallStateFile()})).exitCode()}}l.usage=s.Command.Usage({category:"Workspace-related commands",description:"install a single workspace and its dependencies",details:"\n This command will run an install as if the specified workspaces (and all other workspaces they depend on) were the only ones in the project. If no workspaces are explicitly listed, the active one will be assumed.\n\n Note that this command is only very moderately useful when using zero-installs, since the cache will contain all the packages anyway - meaning that the only difference between a full install and a focused install would just be a few extra lines in the `.pnp.js` file, at the cost of introducing an extra complexity.\n\n If the `-A,--all` flag is set, the entire project will be installed. Combine with `--production` to replicate the old `yarn install --production`.\n\n If the `--production` flag is set, only regular dependencies will be installed, and dev dependencies will be omitted.\n\n If the `--json` flag is set the output will follow a JSON-stream output also known as NDJSON (https://github.com/ndjson/ndjson-spec).\n "}),l.schema=i.object().shape({all:i.bool(),workspaces:i.array().when("all",{is:!0,then:i.array().max(0,"Cannot specify workspaces when using the --all flag"),otherwise:i.array()})}),o([s.Command.Rest()],l.prototype,"workspaces",void 0),o([s.Command.Boolean("--json")],l.prototype,"json",void 0),o([s.Command.Boolean("--production")],l.prototype,"production",void 0),o([s.Command.Boolean("-A,--all")],l.prototype,"all",void 0),o([s.Command.Path("workspaces","focus")],l.prototype,"execute",null);var u=n(401),p=n.n(u),c=n(87),f=n(578),d=n.n(f);const h=(e,t)=>{const n=[];for(const o of e.workspacesCwds){const e=t.workspacesByCwd.get(o);e&&n.push(e,...h(e,t))}return n};class g extends r.BaseCommand{constructor(){super(...arguments),this.args=[],this.allLegacy=!1,this.verbose=!1,this.parallel=!1,this.interlaced=!1,this.topological=!1,this.topologicalDev=!1,this.include=[],this.exclude=[],this.private=!0}async execute(){var e;const t=await a.Configuration.find(this.context.cwd,this.context.plugins),{project:n,workspace:o}=await a.Project.find(t,this.context.cwd),i=null!==(e=this.all)&&void 0!==e?e:this.allLegacy;if(!i&&!o)throw new r.WorkspaceRequiredError(n.cwd,this.context.cwd);const l=this.cli.process([this.commandName,...this.args]),u=1===l.path.length&&"run"===l.path[0]&&void 0!==l.scriptName?l.scriptName:null;if(0===l.path.length)throw new s.UsageError("Invalid subcommand name for iteration - use the 'run' keyword if you wish to execute a script");const f=i?n.topLevelWorkspace:o,g=[f,...h(f,n)],y=[];for(const e of g)u&&!e.manifest.scripts.has(u)||u===process.env.npm_lifecycle_event&&e.cwd===o.cwd||this.include.length>0&&!p().isMatch(a.structUtils.stringifyIdent(e.locator),this.include)||this.exclude.length>0&&p().isMatch(a.structUtils.stringifyIdent(e.locator),this.exclude)||!1===this.private&&!0===e.manifest.private||y.push(e);let R=this.interlaced;this.parallel||(R=!0);const m=new Map,_=new Set,E=this.parallel?Math.max(1,(0,c.cpus)().length/2):1,C=d()(this.jobs||E);let b=0,x=null,v=!1;const S=await a.StreamReport.start({configuration:t,stdout:this.context.stdout},async e=>{const o=async(n,{commandIndex:o})=>{if(v)return-1;!this.parallel&&this.verbose&&o>1&&e.reportSeparator();const r=function(e,{configuration:t,commandIndex:n,verbose:o}){if(!o)return null;const r=a.structUtils.convertToIdent(e.locator),s=`[${a.structUtils.stringifyIdent(r)}]:`,i=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],l=i[n%i.length];return t.format(s,l)}(n,{configuration:t,verbose:this.verbose,commandIndex:o}),[s,i]=A(e,{prefix:r,interlaced:R}),[l,u]=A(e,{prefix:r,interlaced:R});try{const t=await this.cli.run([this.commandName,...this.args],{cwd:n.cwd,stdout:s,stderr:l})||0;s.end(),l.end();const o=await i,a=await u;return this.verbose&&o&&a&&e.reportInfo(null,`${r} Process exited without output (exit code ${t})`),130===t&&(v=!0,x=t),t}catch(e){throw s.end(),l.end(),await i,await u,e}};for(const e of y)m.set(e.anchoredLocator.locatorHash,e);for(;m.size>0&&!e.hasErrors();){const r=[];for(const[e,t]of m){if(_.has(t.anchoredDescriptor.descriptorHash))continue;let a=!0;if(this.topological||this.topologicalDev){const e=this.topologicalDev?new Map([...t.manifest.dependencies,...t.manifest.devDependencies]):t.manifest.dependencies;for(const t of e.values()){const e=n.tryWorkspaceByDescriptor(t);if(a=null===e||!m.has(e.anchoredLocator.locatorHash),!a)break}}if(a&&(_.add(t.anchoredDescriptor.descriptorHash),r.push(C(async()=>{const n=await o(t,{commandIndex:++b});return m.delete(e),_.delete(t.anchoredDescriptor.descriptorHash),n})),!this.parallel))break}if(0===r.length){const n=Array.from(m.values()).map(e=>a.structUtils.prettyLocator(t,e.anchoredLocator)).join(", ");return void e.reportError(a.MessageName.CYCLIC_DEPENDENCIES,`Dependency cycle detected (${n})`)}const s=(await Promise.all(r)).find(e=>0!==e);null===x&&(x=void 0!==s?1:x),(this.topological||this.topologicalDev)&&void 0!==s&&e.reportError(a.MessageName.UNNAMED,"The command failed for workspaces that are depended upon by other workspaces; can't satisfy the dependency graph")}});return null!==x?x:S.exitCode()}}function A(e,{prefix:t,interlaced:n}){const o=e.createStreamReporter(t),r=new a.miscUtils.DefaultStream;r.pipe(o,{end:!1}),r.on("finish",()=>{o.end()});const s=new Promise(e=>{o.on("finish",()=>{e(r.active)})});if(n)return[r,s];const i=new a.miscUtils.BufferStream;return i.pipe(r,{end:!1}),i.on("finish",()=>{r.end()}),[i,s]}g.schema=i.object().shape({jobs:i.number().min(2),parallel:i.boolean().when("jobs",{is:e=>e>1,then:i.boolean().oneOf([!0],"--parallel must be set when using --jobs"),otherwise:i.boolean()})}),g.usage=s.Command.Usage({category:"Workspace-related commands",description:"run a command on all workspaces",details:"\n This command will run a given sub-command on current and all its descendant workspaces. Various flags can alter the exact behavior of the command:\n\n - If `-p,--parallel` is set, the commands will be ran in parallel; they'll by default be limited to a number of parallel tasks roughly equal to half your core number, but that can be overridden via `-j,--jobs`.\n\n - If `-p,--parallel` and `-i,--interlaced` are both set, Yarn will print the lines from the output as it receives them. If `-i,--interlaced` wasn't set, it would instead buffer the output from each process and print the resulting buffers only after their source processes have exited.\n\n - If `-t,--topological` is set, Yarn will only run the command after all workspaces that depend on it through the `dependencies` field have successfully finished executing. If `--topological-dev` is set, both the `dependencies` and `devDependencies` fields will be considered when figuring out the wait points.\n\n - If `-A,--all` is set, Yarn will run the command on all the workspaces of a project. By default yarn runs the command only on current and all its descendant workspaces.\n\n - The command may apply to only some workspaces through the use of `--include` which acts as a whitelist. The `--exclude` flag will do the opposite and will be a list of packages that mustn't execute the script. Both flags accept glob patterns (if valid Idents and supported by [micromatch](https://github.com/micromatch/micromatch)). Make sure to escape the patterns, to prevent your own shell from trying to expand them.\n\n Adding the `-v,--verbose` flag will cause Yarn to print more information; in particular the name of the workspace that generated the output will be printed at the front of each line.\n\n If the command is `run` and the script being run does not exist the child workspace will be skipped without error.\n ",examples:[["Publish current and all descendant packages","yarn workspaces foreach npm publish --tolerate-republish"],["Run build script on current and all descendant packages","yarn workspaces foreach run build"],["Run build script on current and all descendant packages in parallel, building dependent packages first","yarn workspaces foreach -pt run build"]]}),o([s.Command.String()],g.prototype,"commandName",void 0),o([s.Command.Proxy()],g.prototype,"args",void 0),o([s.Command.Boolean("-a",{hidden:!0})],g.prototype,"allLegacy",void 0),o([s.Command.Boolean("-A,--all")],g.prototype,"all",void 0),o([s.Command.Boolean("-v,--verbose")],g.prototype,"verbose",void 0),o([s.Command.Boolean("-p,--parallel")],g.prototype,"parallel",void 0),o([s.Command.Boolean("-i,--interlaced")],g.prototype,"interlaced",void 0),o([s.Command.String("-j,--jobs")],g.prototype,"jobs",void 0),o([s.Command.Boolean("-t,--topological")],g.prototype,"topological",void 0),o([s.Command.Boolean("--topological-dev")],g.prototype,"topologicalDev",void 0),o([s.Command.Array("--include")],g.prototype,"include",void 0),o([s.Command.Array("--exclude")],g.prototype,"exclude",void 0),o([s.Command.Boolean("--private")],g.prototype,"private",void 0),o([s.Command.Path("workspaces","foreach")],g.prototype,"execute",null);const y={commands:[l,g]}},235:(e,t,n)=>{const o=n(900),r=n(617),a=n(495),s=n(425),i=(e,t={})=>{let n=[];if(Array.isArray(e))for(let o of e){let e=i.create(o,t);Array.isArray(e)?n.push(...e):n.push(e)}else n=[].concat(i.create(e,t));return t&&!0===t.expand&&!0===t.nodupes&&(n=[...new Set(n)]),n};i.parse=(e,t={})=>s(e,t),i.stringify=(e,t={})=>o("string"==typeof e?i.parse(e,t):e,t),i.compile=(e,t={})=>("string"==typeof e&&(e=i.parse(e,t)),r(e,t)),i.expand=(e,t={})=>{"string"==typeof e&&(e=i.parse(e,t));let n=a(e,t);return!0===t.noempty&&(n=n.filter(Boolean)),!0===t.nodupes&&(n=[...new Set(n)]),n},i.create=(e,t={})=>""===e||e.length<3?[e]:!0!==t.expand?i.compile(e,t):i.expand(e,t),e.exports=i},617:(e,t,n)=>{const o=n(169),r=n(542);e.exports=(e,t={})=>{let n=(e,a={})=>{let s=r.isInvalidBrace(a),i=!0===e.invalid&&!0===t.escapeInvalid,l=!0===s||!0===i,u=!0===t.escapeInvalid?"\\":"",p="";if(!0===e.isOpen)return u+e.value;if(!0===e.isClose)return u+e.value;if("open"===e.type)return l?u+e.value:"(";if("close"===e.type)return l?u+e.value:")";if("comma"===e.type)return"comma"===e.prev.type?"":l?e.value:"|";if(e.value)return e.value;if(e.nodes&&e.ranges>0){let n=r.reduce(e.nodes),a=o(...n,{...t,wrap:!1,toRegex:!0});if(0!==a.length)return n.length>1&&a.length>1?`(${a})`:a}if(e.nodes)for(let t of e.nodes)p+=n(t,e);return p};return n(e)}},384:e=>{e.exports={MAX_LENGTH:65536,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:"\n",CHAR_NO_BREAK_SPACE:" ",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:"\t",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\ufeff"}},495:(e,t,n)=>{const o=n(169),r=n(900),a=n(542),s=(e="",t="",n=!1)=>{let o=[];if(e=[].concat(e),!(t=[].concat(t)).length)return e;if(!e.length)return n?a.flatten(t).map(e=>`{${e}}`):t;for(let r of e)if(Array.isArray(r))for(let e of r)o.push(s(e,t,n));else for(let e of t)!0===n&&"string"==typeof e&&(e=`{${e}}`),o.push(Array.isArray(e)?s(r,e,n):r+e);return a.flatten(o)};e.exports=(e,t={})=>{let n=void 0===t.rangeLimit?1e3:t.rangeLimit,i=(e,l={})=>{e.queue=[];let u=l,p=l.queue;for(;"brace"!==u.type&&"root"!==u.type&&u.parent;)u=u.parent,p=u.queue;if(e.invalid||e.dollar)return void p.push(s(p.pop(),r(e,t)));if("brace"===e.type&&!0!==e.invalid&&2===e.nodes.length)return void p.push(s(p.pop(),["{}"]));if(e.nodes&&e.ranges>0){let i=a.reduce(e.nodes);if(a.exceedsLimit(...i,t.step,n))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let l=o(...i,t);return 0===l.length&&(l=r(e,t)),p.push(s(p.pop(),l)),void(e.nodes=[])}let c=a.encloseBrace(e),f=e.queue,d=e;for(;"brace"!==d.type&&"root"!==d.type&&d.parent;)d=d.parent,f=d.queue;for(let t=0;t{const o=n(900),{MAX_LENGTH:r,CHAR_BACKSLASH:a,CHAR_BACKTICK:s,CHAR_COMMA:i,CHAR_DOT:l,CHAR_LEFT_PARENTHESES:u,CHAR_RIGHT_PARENTHESES:p,CHAR_LEFT_CURLY_BRACE:c,CHAR_RIGHT_CURLY_BRACE:f,CHAR_LEFT_SQUARE_BRACKET:d,CHAR_RIGHT_SQUARE_BRACKET:h,CHAR_DOUBLE_QUOTE:g,CHAR_SINGLE_QUOTE:A,CHAR_NO_BREAK_SPACE:y,CHAR_ZERO_WIDTH_NOBREAK_SPACE:R}=n(384);e.exports=(e,t={})=>{if("string"!=typeof e)throw new TypeError("Expected a string");let n=t||{},m="number"==typeof n.maxLength?Math.min(r,n.maxLength):r;if(e.length>m)throw new SyntaxError(`Input length (${e.length}), exceeds max characters (${m})`);let _,E={type:"root",input:e,nodes:[]},C=[E],b=E,x=E,v=0,S=e.length,w=0,H=0;const T=()=>e[w++],L=e=>{if("text"===e.type&&"dot"===x.type&&(x.type="text"),!x||"text"!==x.type||"text"!==e.type)return b.nodes.push(e),e.parent=b,e.prev=x,x=e,e;x.value+=e.value};for(L({type:"bos"});w0){if(b.ranges>0){b.ranges=0;let e=b.nodes.shift();b.nodes=[e,{type:"text",value:o(b)}]}L({type:"comma",value:_}),b.commas++}else if(_===l&&H>0&&0===b.commas){let e=b.nodes;if(0===H||0===e.length){L({type:"text",value:_});continue}if("dot"===x.type){if(b.range=[],x.value+=_,x.type="range",3!==b.nodes.length&&5!==b.nodes.length){b.invalid=!0,b.ranges=0,x.type="text";continue}b.ranges++,b.args=[];continue}if("range"===x.type){e.pop();let t=e[e.length-1];t.value+=x.value+_,x=t,b.ranges--;continue}L({type:"dot",value:_})}else L({type:"text",value:_});else{if("brace"!==b.type){L({type:"text",value:_});continue}let e="close";b=C.pop(),b.close=!0,L({type:e,value:_}),H--,b=C[C.length-1]}else{H++;let e=x.value&&"$"===x.value.slice(-1)||!0===b.dollar;b=L({type:"brace",open:!0,close:!1,dollar:e,depth:H,commas:0,ranges:0,nodes:[]}),C.push(b),L({type:"open",value:_})}else{let e,n=_;for(!0!==t.keepQuotes&&(_="");w{e.nodes||("open"===e.type&&(e.isOpen=!0),"close"===e.type&&(e.isClose=!0),e.nodes||(e.type="text"),e.invalid=!0)});let e=C[C.length-1],t=e.nodes.indexOf(b);e.nodes.splice(t,1,...b.nodes)}}while(C.length>0);return L({type:"eos"}),E}},900:(e,t,n)=>{const o=n(542);e.exports=(e,t={})=>{let n=(e,r={})=>{let a=t.escapeInvalid&&o.isInvalidBrace(r),s=!0===e.invalid&&!0===t.escapeInvalid,i="";if(e.value)return(a||s)&&o.isOpenOrClose(e)?"\\"+e.value:e.value;if(e.value)return e.value;if(e.nodes)for(let t of e.nodes)i+=n(t);return i};return n(e)}},542:(e,t)=>{t.isInteger=e=>"number"==typeof e?Number.isInteger(e):"string"==typeof e&&""!==e.trim()&&Number.isInteger(Number(e)),t.find=(e,t)=>e.nodes.find(e=>e.type===t),t.exceedsLimit=(e,n,o=1,r)=>!1!==r&&(!(!t.isInteger(e)||!t.isInteger(n))&&(Number(n)-Number(e))/Number(o)>=r),t.escapeNode=(e,t=0,n)=>{let o=e.nodes[t];o&&(n&&o.type===n||"open"===o.type||"close"===o.type)&&!0!==o.escaped&&(o.value="\\"+o.value,o.escaped=!0)},t.encloseBrace=e=>"brace"===e.type&&(e.commas>>0+e.ranges>>0==0&&(e.invalid=!0,!0)),t.isInvalidBrace=e=>"brace"===e.type&&(!(!0!==e.invalid&&!e.dollar)||(e.commas>>0+e.ranges>>0==0||!0!==e.open||!0!==e.close)&&(e.invalid=!0,!0)),t.isOpenOrClose=e=>"open"===e.type||"close"===e.type||(!0===e.open||!0===e.close),t.reduce=e=>e.reduce((e,t)=>("text"===t.type&&e.push(t.value),"range"===t.type&&(t.type="text"),e),[]),t.flatten=(...e)=>{const t=[],n=e=>{for(let o=0;o{ 6 | /*! 7 | * fill-range 8 | * 9 | * Copyright (c) 2014-present, Jon Schlinkert. 10 | * Licensed under the MIT License. 11 | */ 12 | const o=n(669),r=n(615),a=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),s=e=>"number"==typeof e||"string"==typeof e&&""!==e,i=e=>Number.isInteger(+e),l=e=>{let t=""+e,n=-1;if("-"===t[0]&&(t=t.slice(1)),"0"===t)return!1;for(;"0"===t[++n];);return n>0},u=(e,t,n)=>{if(t>0){let n="-"===e[0]?"-":"";n&&(e=e.slice(1)),e=n+e.padStart(n?t-1:t,"0")}return!1===n?String(e):e},p=(e,t)=>{let n="-"===e[0]?"-":"";for(n&&(e=e.slice(1),t--);e.length{if(n)return r(e,t,{wrap:!1,...o});let a=String.fromCharCode(e);return e===t?a:`[${a}-${String.fromCharCode(t)}]`},f=(e,t,n)=>{if(Array.isArray(e)){let t=!0===n.wrap,o=n.capture?"":"?:";return t?`(${o}${e.join("|")})`:e.join("|")}return r(e,t,n)},d=(...e)=>new RangeError("Invalid range arguments: "+o.inspect(...e)),h=(e,t,n)=>{if(!0===n.strictRanges)throw d([e,t]);return[]},g=(e,t,n=1,o={})=>{let r=Number(e),a=Number(t);if(!Number.isInteger(r)||!Number.isInteger(a)){if(!0===o.strictRanges)throw d([e,t]);return[]}0===r&&(r=0),0===a&&(a=0);let s=r>a,i=String(e),h=String(t),g=String(n);n=Math.max(Math.abs(n),1);let A=l(i)||l(h)||l(g),y=A?Math.max(i.length,h.length,g.length):0,R=!1===A&&!1===((e,t,n)=>"string"==typeof e||"string"==typeof t||!0===n.stringify)(e,t,o),m=o.transform||(e=>t=>!0===e?Number(t):String(t))(R);if(o.toRegex&&1===n)return c(p(e,y),p(t,y),!0,o);let _={negatives:[],positives:[]},E=[],C=0;for(;s?r>=a:r<=a;)!0===o.toRegex&&n>1?_[(b=r)<0?"negatives":"positives"].push(Math.abs(b)):E.push(u(m(r,C),y,R)),r=s?r-n:r+n,C++;var b;return!0===o.toRegex?n>1?((e,t)=>{e.negatives.sort((e,t)=>et?1:0),e.positives.sort((e,t)=>et?1:0);let n,o=t.capture?"":"?:",r="",a="";return e.positives.length&&(r=e.positives.join("|")),e.negatives.length&&(a=`-(${o}${e.negatives.join("|")})`),n=r&&a?`${r}|${a}`:r||a,t.wrap?`(${o}${n})`:n})(_,o):f(E,null,{wrap:!1,...o}):E},A=(e,t,n,o={})=>{if(null==t&&s(e))return[e];if(!s(e)||!s(t))return h(e,t,o);if("function"==typeof n)return A(e,t,1,{transform:n});if(a(n))return A(e,t,0,n);let r={...o};return!0===r.capture&&(r.wrap=!0),n=n||r.step||1,i(n)?i(e)&&i(t)?g(e,t,n,r):((e,t,n=1,o={})=>{if(!i(e)&&e.length>1||!i(t)&&t.length>1)return h(e,t,o);let r=o.transform||(e=>String.fromCharCode(e)),a=(""+e).charCodeAt(0),s=(""+t).charCodeAt(0),l=a>s,u=Math.min(a,s),p=Math.max(a,s);if(o.toRegex&&1===n)return c(u,p,!1,o);let d=[],g=0;for(;l?a>=s:a<=s;)d.push(r(a,g)),a=l?a-n:a+n,g++;return!0===o.toRegex?f(d,null,{wrap:!1,options:o}):d})(e,t,Math.max(Math.abs(n),1),r):null==n||a(n)?A(e,t,1,n):((e,t)=>{if(!0===t.strictRanges)throw new TypeError(`Expected step "${e}" to be a number`);return[]})(n,r)};e.exports=A},761:e=>{ 13 | /*! 14 | * is-number 15 | * 16 | * Copyright (c) 2014-present, Jon Schlinkert. 17 | * Released under the MIT License. 18 | */ 19 | e.exports=function(e){return"number"==typeof e?e-e==0:"string"==typeof e&&""!==e.trim()&&(Number.isFinite?Number.isFinite(+e):isFinite(+e))}},401:(e,t,n)=>{const o=n(669),r=n(235),a=n(722),s=n(598),i=e=>"string"==typeof e&&(""===e||"./"===e),l=(e,t,n)=>{t=[].concat(t),e=[].concat(e);let o=new Set,r=new Set,s=new Set,i=0,l=e=>{s.add(e.output),n&&n.onResult&&n.onResult(e)};for(let s=0;s!o.has(e));if(n&&0===u.length){if(!0===n.failglob)throw new Error(`No matches found for "${t.join(", ")}"`);if(!0===n.nonull||!0===n.nullglob)return n.unescape?t.map(e=>e.replace(/\\/g,"")):t}return u};l.match=l,l.matcher=(e,t)=>a(e,t),l.any=l.isMatch=(e,t,n)=>a(t,n)(e),l.not=(e,t,n={})=>{t=[].concat(t).map(String);let o=new Set,r=[],a=l(e,t,{...n,onResult:e=>{n.onResult&&n.onResult(e),r.push(e.output)}});for(let e of r)a.includes(e)||o.add(e);return[...o]},l.contains=(e,t,n)=>{if("string"!=typeof e)throw new TypeError(`Expected a string: "${o.inspect(e)}"`);if(Array.isArray(t))return t.some(t=>l.contains(e,t,n));if("string"==typeof t){if(i(e)||i(t))return!1;if(e.includes(t)||e.startsWith("./")&&e.slice(2).includes(t))return!0}return l.isMatch(e,t,{...n,contains:!0})},l.matchKeys=(e,t,n)=>{if(!s.isObject(e))throw new TypeError("Expected the first argument to be an object");let o=l(Object.keys(e),t,n),r={};for(let t of o)r[t]=e[t];return r},l.some=(e,t,n)=>{let o=[].concat(e);for(let e of[].concat(t)){let t=a(String(e),n);if(o.some(e=>t(e)))return!0}return!1},l.every=(e,t,n)=>{let o=[].concat(e);for(let e of[].concat(t)){let t=a(String(e),n);if(!o.every(e=>t(e)))return!1}return!0},l.all=(e,t,n)=>{if("string"!=typeof e)throw new TypeError(`Expected a string: "${o.inspect(e)}"`);return[].concat(t).every(t=>a(t,n)(e))},l.capture=(e,t,n)=>{let o=s.isWindows(n),r=a.makeRe(String(e),{...n,capture:!0}).exec(o?s.toPosixSlashes(t):t);if(r)return r.slice(1).map(e=>void 0===e?"":e)},l.makeRe=(...e)=>a.makeRe(...e),l.scan=(...e)=>a.scan(...e),l.parse=(e,t)=>{let n=[];for(let o of[].concat(e||[]))for(let e of r(String(o),t))n.push(a.parse(e,t));return n},l.braces=(e,t)=>{if("string"!=typeof e)throw new TypeError("Expected a string");return t&&!0===t.nobrace||!/\{.*\}/.test(e)?[e]:r(e,t)},l.braceExpand=(e,t)=>{if("string"!=typeof e)throw new TypeError("Expected a string");return l.braces(e,{...t,expand:!0})},e.exports=l},578:(e,t,n)=>{const o=n(550),r=e=>{if(e<1)throw new TypeError("Expected `concurrency` to be a number from 1 and up");const t=[];let n=0;const r=()=>{n--,t.length>0&&t.shift()()},a=(e,t,...a)=>{n++;const s=o(e,...a);t(s),s.then(r,r)},s=(o,...r)=>new Promise(s=>((o,r,...s)=>{nn},pendingCount:{get:()=>t.length}}),s};e.exports=r,e.exports.default=r},550:e=>{e.exports=(e,...t)=>new Promise(n=>{n(e(...t))})},722:(e,t,n)=>{e.exports=n(828)},86:(e,t,n)=>{const o=n(622),r={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:"(?=.)",QMARK:"[^/]",END_ANCHOR:"(?:\\/|$)",DOTS_SLASH:"\\.{1,2}(?:\\/|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|\\/)\\.{1,2}(?:\\/|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:\\/|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:\\/|$))",QMARK_NO_DOT:"[^.\\/]",STAR:"[^/]*?",START_ANCHOR:"(?:^|\\/)"},a={...r,SLASH_LITERAL:"[\\\\/]",QMARK:"[^\\\\/]",STAR:"[^\\\\/]*?",DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)"};e.exports={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:{alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"},REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:o.sep,extglobChars:e=>({"!":{type:"negate",open:"(?:(?!(?:",close:`))${e.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}),globChars:e=>!0===e?a:r}},974:(e,t,n)=>{const o=n(86),r=n(598),{MAX_LENGTH:a,POSIX_REGEX_SOURCE:s,REGEX_NON_SPECIAL_CHARS:i,REGEX_SPECIAL_CHARS_BACKREF:l,REPLACEMENTS:u}=o,p=(e,t)=>{if("function"==typeof t.expandRange)return t.expandRange(...e,t);e.sort();const n=`[${e.join("-")}]`;try{new RegExp(n)}catch(t){return e.map(e=>r.escapeRegex(e)).join("..")}return n},c=(e,t)=>`Missing ${e}: "${t}" - use "\\\\${t}" to match literal characters`,f=(e,t)=>{if("string"!=typeof e)throw new TypeError("Expected a string");e=u[e]||e;const n={...t},f="number"==typeof n.maxLength?Math.min(a,n.maxLength):a;let d=e.length;if(d>f)throw new SyntaxError(`Input length: ${d}, exceeds maximum allowed length: ${f}`);const h={type:"bos",value:"",output:n.prepend||""},g=[h],A=n.capture?"":"?:",y=r.isWindows(t),R=o.globChars(y),m=o.extglobChars(R),{DOT_LITERAL:_,PLUS_LITERAL:E,SLASH_LITERAL:C,ONE_CHAR:b,DOTS_SLASH:x,NO_DOT:v,NO_DOT_SLASH:S,NO_DOTS_SLASH:w,QMARK:H,QMARK_NO_DOT:T,STAR:L,START_ANCHOR:k}=R,O=e=>`(${A}(?:(?!${k}${e.dot?x:_}).)*?)`,$=n.dot?"":v,N=n.dot?H:T;let I=!0===n.bash?O(n):L;n.capture&&(I=`(${I})`),"boolean"==typeof n.noext&&(n.noextglob=n.noext);const B={input:e,index:-1,start:0,dot:!0===n.dot,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:g};e=r.removePrefix(e,B),d=e.length;const M=[],P=[],D=[];let U,G=h;const j=()=>B.index===d-1,K=B.peek=(t=1)=>e[B.index+t],F=B.advance=()=>e[++B.index],W=()=>e.slice(B.index+1),Q=(e="",t=0)=>{B.consumed+=e,B.index+=t},X=e=>{B.output+=null!=e.output?e.output:e.value,Q(e.value)},q=()=>{let e=1;for(;"!"===K()&&("("!==K(2)||"?"===K(3));)F(),B.start++,e++;return e%2!=0&&(B.negated=!0,B.start++,!0)},Z=e=>{B[e]++,D.push(e)},Y=e=>{B[e]--,D.pop()},z=e=>{if("globstar"===G.type){const t=B.braces>0&&("comma"===e.type||"brace"===e.type),n=!0===e.extglob||M.length&&("pipe"===e.type||"paren"===e.type);"slash"===e.type||"paren"===e.type||t||n||(B.output=B.output.slice(0,-G.output.length),G.type="star",G.value="*",G.output=I,B.output+=G.output)}if(M.length&&"paren"!==e.type&&!m[e.value]&&(M[M.length-1].inner+=e.value),(e.value||e.output)&&X(e),G&&"text"===G.type&&"text"===e.type)return G.value+=e.value,void(G.output=(G.output||"")+e.value);e.prev=G,g.push(e),G=e},V=(e,t)=>{const o={...m[t],conditions:1,inner:""};o.prev=G,o.parens=B.parens,o.output=B.output;const r=(n.capture?"(":"")+o.open;Z("parens"),z({type:e,value:t,output:B.output?"":b}),z({type:"paren",extglob:!0,value:F(),output:r}),M.push(o)},J=e=>{let t=e.close+(n.capture?")":"");if("negate"===e.type){let o=I;e.inner&&e.inner.length>1&&e.inner.includes("/")&&(o=O(n)),(o!==I||j()||/^\)+$/.test(W()))&&(t=e.close=")$))"+o),"bos"===e.prev.type&&j()&&(B.negatedExtglob=!0)}z({type:"paren",extglob:!0,value:U,output:t}),Y("parens")};if(!1!==n.fastpaths&&!/(^[*!]|[/()[\]{}"])/.test(e)){let o=!1,a=e.replace(l,(e,t,n,r,a,s)=>"\\"===r?(o=!0,e):"?"===r?t?t+r+(a?H.repeat(a.length):""):0===s?N+(a?H.repeat(a.length):""):H.repeat(n.length):"."===r?_.repeat(n.length):"*"===r?t?t+r+(a?I:""):I:t?e:"\\"+e);return!0===o&&(a=!0===n.unescape?a.replace(/\\/g,""):a.replace(/\\+/g,e=>e.length%2==0?"\\\\":e?"\\":"")),a===e&&!0===n.contains?(B.output=e,B):(B.output=r.wrapOutput(a,B,t),B)}for(;!j();){if(U=F(),"\0"===U)continue;if("\\"===U){const e=K();if("/"===e&&!0!==n.bash)continue;if("."===e||";"===e)continue;if(!e){U+="\\",z({type:"text",value:U});continue}const t=/^\\+/.exec(W());let o=0;if(t&&t[0].length>2&&(o=t[0].length,B.index+=o,o%2!=0&&(U+="\\")),!0===n.unescape?U=F()||"":U+=F()||"",0===B.brackets){z({type:"text",value:U});continue}}if(B.brackets>0&&("]"!==U||"["===G.value||"[^"===G.value)){if(!1!==n.posix&&":"===U){const e=G.value.slice(1);if(e.includes("[")&&(G.posix=!0,e.includes(":"))){const e=G.value.lastIndexOf("["),t=G.value.slice(0,e),n=G.value.slice(e+2),o=s[n];if(o){G.value=t+o,B.backtrack=!0,F(),h.output||1!==g.indexOf(G)||(h.output=b);continue}}}("["===U&&":"!==K()||"-"===U&&"]"===K())&&(U="\\"+U),"]"!==U||"["!==G.value&&"[^"!==G.value||(U="\\"+U),!0===n.posix&&"!"===U&&"["===G.value&&(U="^"),G.value+=U,X({value:U});continue}if(1===B.quotes&&'"'!==U){U=r.escapeRegex(U),G.value+=U,X({value:U});continue}if('"'===U){B.quotes=1===B.quotes?0:1,!0===n.keepQuotes&&z({type:"text",value:U});continue}if("("===U){Z("parens"),z({type:"paren",value:U});continue}if(")"===U){if(0===B.parens&&!0===n.strictBrackets)throw new SyntaxError(c("opening","("));const e=M[M.length-1];if(e&&B.parens===e.parens+1){J(M.pop());continue}z({type:"paren",value:U,output:B.parens?")":"\\)"}),Y("parens");continue}if("["===U){if(!0!==n.nobracket&&W().includes("]"))Z("brackets");else{if(!0!==n.nobracket&&!0===n.strictBrackets)throw new SyntaxError(c("closing","]"));U="\\"+U}z({type:"bracket",value:U});continue}if("]"===U){if(!0===n.nobracket||G&&"bracket"===G.type&&1===G.value.length){z({type:"text",value:U,output:"\\"+U});continue}if(0===B.brackets){if(!0===n.strictBrackets)throw new SyntaxError(c("opening","["));z({type:"text",value:U,output:"\\"+U});continue}Y("brackets");const e=G.value.slice(1);if(!0===G.posix||"^"!==e[0]||e.includes("/")||(U="/"+U),G.value+=U,X({value:U}),!1===n.literalBrackets||r.hasRegexChars(e))continue;const t=r.escapeRegex(G.value);if(B.output=B.output.slice(0,-G.value.length),!0===n.literalBrackets){B.output+=t,G.value=t;continue}G.value=`(${A}${t}|${G.value})`,B.output+=G.value;continue}if("{"===U&&!0!==n.nobrace){Z("braces");const e={type:"brace",value:U,output:"(",outputIndex:B.output.length,tokensIndex:B.tokens.length};P.push(e),z(e);continue}if("}"===U){const e=P[P.length-1];if(!0===n.nobrace||!e){z({type:"text",value:U,output:U});continue}let t=")";if(!0===e.dots){const e=g.slice(),o=[];for(let t=e.length-1;t>=0&&(g.pop(),"brace"!==e[t].type);t--)"dots"!==e[t].type&&o.unshift(e[t].value);t=p(o,n),B.backtrack=!0}if(!0!==e.comma&&!0!==e.dots){const n=B.output.slice(0,e.outputIndex),o=B.tokens.slice(e.tokensIndex);e.value=e.output="\\{",U=t="\\}",B.output=n;for(const e of o)B.output+=e.output||e.value}z({type:"brace",value:U,output:t}),Y("braces"),P.pop();continue}if("|"===U){M.length>0&&M[M.length-1].conditions++,z({type:"text",value:U});continue}if(","===U){let e=U;const t=P[P.length-1];t&&"braces"===D[D.length-1]&&(t.comma=!0,e="|"),z({type:"comma",value:U,output:e});continue}if("/"===U){if("dot"===G.type&&B.index===B.start+1){B.start=B.index+1,B.consumed="",B.output="",g.pop(),G=h;continue}z({type:"slash",value:U,output:C});continue}if("."===U){if(B.braces>0&&"dot"===G.type){"."===G.value&&(G.output=_);const e=P[P.length-1];G.type="dots",G.output+=U,G.value+=U,e.dots=!0;continue}if(B.braces+B.parens===0&&"bos"!==G.type&&"slash"!==G.type){z({type:"text",value:U,output:_});continue}z({type:"dot",value:U,output:_});continue}if("?"===U){if(!(G&&"("===G.value)&&!0!==n.noextglob&&"("===K()&&"?"!==K(2)){V("qmark",U);continue}if(G&&"paren"===G.type){const e=K();let t=U;if("<"===e&&!r.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");("("===G.value&&!/[!=<:]/.test(e)||"<"===e&&!/<([!=]|\w+>)/.test(W()))&&(t="\\"+U),z({type:"text",value:U,output:t});continue}if(!0!==n.dot&&("slash"===G.type||"bos"===G.type)){z({type:"qmark",value:U,output:T});continue}z({type:"qmark",value:U,output:H});continue}if("!"===U){if(!0!==n.noextglob&&"("===K()&&("?"!==K(2)||!/[!=<:]/.test(K(3)))){V("negate",U);continue}if(!0!==n.nonegate&&0===B.index){q();continue}}if("+"===U){if(!0!==n.noextglob&&"("===K()&&"?"!==K(2)){V("plus",U);continue}if(G&&"("===G.value||!1===n.regex){z({type:"plus",value:U,output:E});continue}if(G&&("bracket"===G.type||"paren"===G.type||"brace"===G.type)||B.parens>0){z({type:"plus",value:U});continue}z({type:"plus",value:E});continue}if("@"===U){if(!0!==n.noextglob&&"("===K()&&"?"!==K(2)){z({type:"at",extglob:!0,value:U,output:""});continue}z({type:"text",value:U});continue}if("*"!==U){"$"!==U&&"^"!==U||(U="\\"+U);const e=i.exec(W());e&&(U+=e[0],B.index+=e[0].length),z({type:"text",value:U});continue}if(G&&("globstar"===G.type||!0===G.star)){G.type="star",G.star=!0,G.value+=U,G.output=I,B.backtrack=!0,B.globstar=!0,Q(U);continue}let t=W();if(!0!==n.noextglob&&/^\([^?]/.test(t)){V("star",U);continue}if("star"===G.type){if(!0===n.noglobstar){Q(U);continue}const o=G.prev,r=o.prev,a="slash"===o.type||"bos"===o.type,s=r&&("star"===r.type||"globstar"===r.type);if(!0===n.bash&&(!a||t[0]&&"/"!==t[0])){z({type:"star",value:U,output:""});continue}const i=B.braces>0&&("comma"===o.type||"brace"===o.type),l=M.length&&("pipe"===o.type||"paren"===o.type);if(!a&&"paren"!==o.type&&!i&&!l){z({type:"star",value:U,output:""});continue}for(;"/**"===t.slice(0,3);){const n=e[B.index+4];if(n&&"/"!==n)break;t=t.slice(3),Q("/**",3)}if("bos"===o.type&&j()){G.type="globstar",G.value+=U,G.output=O(n),B.output=G.output,B.globstar=!0,Q(U);continue}if("slash"===o.type&&"bos"!==o.prev.type&&!s&&j()){B.output=B.output.slice(0,-(o.output+G.output).length),o.output="(?:"+o.output,G.type="globstar",G.output=O(n)+(n.strictSlashes?")":"|$)"),G.value+=U,B.globstar=!0,B.output+=o.output+G.output,Q(U);continue}if("slash"===o.type&&"bos"!==o.prev.type&&"/"===t[0]){const e=void 0!==t[1]?"|$":"";B.output=B.output.slice(0,-(o.output+G.output).length),o.output="(?:"+o.output,G.type="globstar",G.output=`${O(n)}${C}|${C}${e})`,G.value+=U,B.output+=o.output+G.output,B.globstar=!0,Q(U+F()),z({type:"slash",value:"/",output:""});continue}if("bos"===o.type&&"/"===t[0]){G.type="globstar",G.value+=U,G.output=`(?:^|${C}|${O(n)}${C})`,B.output=G.output,B.globstar=!0,Q(U+F()),z({type:"slash",value:"/",output:""});continue}B.output=B.output.slice(0,-G.output.length),G.type="globstar",G.output=O(n),G.value+=U,B.output+=G.output,B.globstar=!0,Q(U);continue}const o={type:"star",value:U,output:I};!0!==n.bash?!G||"bracket"!==G.type&&"paren"!==G.type||!0!==n.regex?(B.index!==B.start&&"slash"!==G.type&&"dot"!==G.type||("dot"===G.type?(B.output+=S,G.output+=S):!0===n.dot?(B.output+=w,G.output+=w):(B.output+=$,G.output+=$),"*"!==K()&&(B.output+=b,G.output+=b)),z(o)):(o.output=U,z(o)):(o.output=".*?","bos"!==G.type&&"slash"!==G.type||(o.output=$+o.output),z(o))}for(;B.brackets>0;){if(!0===n.strictBrackets)throw new SyntaxError(c("closing","]"));B.output=r.escapeLast(B.output,"["),Y("brackets")}for(;B.parens>0;){if(!0===n.strictBrackets)throw new SyntaxError(c("closing",")"));B.output=r.escapeLast(B.output,"("),Y("parens")}for(;B.braces>0;){if(!0===n.strictBrackets)throw new SyntaxError(c("closing","}"));B.output=r.escapeLast(B.output,"{"),Y("braces")}if(!0===n.strictSlashes||"star"!==G.type&&"bracket"!==G.type||z({type:"maybe_slash",value:"",output:C+"?"}),!0===B.backtrack){B.output="";for(const e of B.tokens)B.output+=null!=e.output?e.output:e.value,e.suffix&&(B.output+=e.suffix)}return B};f.fastpaths=(e,t)=>{const n={...t},s="number"==typeof n.maxLength?Math.min(a,n.maxLength):a,i=e.length;if(i>s)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${s}`);e=u[e]||e;const l=r.isWindows(t),{DOT_LITERAL:p,SLASH_LITERAL:c,ONE_CHAR:f,DOTS_SLASH:d,NO_DOT:h,NO_DOTS:g,NO_DOTS_SLASH:A,STAR:y,START_ANCHOR:R}=o.globChars(l),m=n.dot?g:h,_=n.dot?A:h,E=n.capture?"":"?:";let C=!0===n.bash?".*?":y;n.capture&&(C=`(${C})`);const b=e=>!0===e.noglobstar?C:`(${E}(?:(?!${R}${e.dot?d:p}).)*?)`,x=e=>{switch(e){case"*":return`${m}${f}${C}`;case".*":return`${p}${f}${C}`;case"*.*":return`${m}${C}${p}${f}${C}`;case"*/*":return`${m}${C}${c}${f}${_}${C}`;case"**":return m+b(n);case"**/*":return`(?:${m}${b(n)}${c})?${_}${f}${C}`;case"**/*.*":return`(?:${m}${b(n)}${c})?${_}${C}${p}${f}${C}`;case"**/.*":return`(?:${m}${b(n)}${c})?${p}${f}${C}`;default:{const t=/^(.*?)\.(\w+)$/.exec(e);if(!t)return;const n=x(t[1]);if(!n)return;return n+p+t[2]}}},v=r.removePrefix(e,{negated:!1,prefix:""});let S=x(v);return S&&!0!==n.strictSlashes&&(S+=c+"?"),S},e.exports=f},828:(e,t,n)=>{const o=n(622),r=n(321),a=n(974),s=n(598),i=n(86),l=(e,t,n=!1)=>{if(Array.isArray(e)){const o=e.map(e=>l(e,t,n));return e=>{for(const t of o){const n=t(e);if(n)return n}return!1}}const o=(r=e)&&"object"==typeof r&&!Array.isArray(r)&&e.tokens&&e.input;var r;if(""===e||"string"!=typeof e&&!o)throw new TypeError("Expected pattern to be a non-empty string");const a=t||{},i=s.isWindows(t),u=o?l.compileRe(e,t):l.makeRe(e,t,!1,!0),p=u.state;delete u.state;let c=()=>!1;if(a.ignore){const e={...t,ignore:null,onMatch:null,onResult:null};c=l(a.ignore,e,n)}const f=(n,o=!1)=>{const{isMatch:r,match:s,output:f}=l.test(n,u,t,{glob:e,posix:i}),d={glob:e,state:p,regex:u,posix:i,input:n,output:f,match:s,isMatch:r};return"function"==typeof a.onResult&&a.onResult(d),!1===r?(d.isMatch=!1,!!o&&d):c(n)?("function"==typeof a.onIgnore&&a.onIgnore(d),d.isMatch=!1,!!o&&d):("function"==typeof a.onMatch&&a.onMatch(d),!o||d)};return n&&(f.state=p),f};l.test=(e,t,n,{glob:o,posix:r}={})=>{if("string"!=typeof e)throw new TypeError("Expected input to be a string");if(""===e)return{isMatch:!1,output:""};const a=n||{},i=a.format||(r?s.toPosixSlashes:null);let u=e===o,p=u&&i?i(e):e;return!1===u&&(p=i?i(e):e,u=p===o),!1!==u&&!0!==a.capture||(u=!0===a.matchBase||!0===a.basename?l.matchBase(e,t,n,r):t.exec(p)),{isMatch:Boolean(u),match:u,output:p}},l.matchBase=(e,t,n,r=s.isWindows(n))=>(t instanceof RegExp?t:l.makeRe(t,n)).test(o.basename(e)),l.isMatch=(e,t,n)=>l(t,n)(e),l.parse=(e,t)=>Array.isArray(e)?e.map(e=>l.parse(e,t)):a(e,{...t,fastpaths:!1}),l.scan=(e,t)=>r(e,t),l.compileRe=(e,t,n=!1,o=!1)=>{if(!0===n)return e.output;const r=t||{},a=r.contains?"":"^",s=r.contains?"":"$";let i=`${a}(?:${e.output})${s}`;e&&!0===e.negated&&(i=`^(?!${i}).*$`);const u=l.toRegex(i,t);return!0===o&&(u.state=e),u},l.makeRe=(e,t,n=!1,o=!1)=>{if(!e||"string"!=typeof e)throw new TypeError("Expected a non-empty string");const r=t||{};let s,i={negated:!1,fastpaths:!0},u="";return e.startsWith("./")&&(e=e.slice(2),u=i.prefix="./"),!1===r.fastpaths||"."!==e[0]&&"*"!==e[0]||(s=a.fastpaths(e,t)),void 0===s?(i=a(e,t),i.prefix=u+(i.prefix||"")):i.output=s,l.compileRe(i,t,n,o)},l.toRegex=(e,t)=>{try{const n=t||{};return new RegExp(e,n.flags||(n.nocase?"i":""))}catch(e){if(t&&!0===t.debug)throw e;return/$^/}},l.constants=i,e.exports=l},321:(e,t,n)=>{const o=n(598),{CHAR_ASTERISK:r,CHAR_AT:a,CHAR_BACKWARD_SLASH:s,CHAR_COMMA:i,CHAR_DOT:l,CHAR_EXCLAMATION_MARK:u,CHAR_FORWARD_SLASH:p,CHAR_LEFT_CURLY_BRACE:c,CHAR_LEFT_PARENTHESES:f,CHAR_LEFT_SQUARE_BRACKET:d,CHAR_PLUS:h,CHAR_QUESTION_MARK:g,CHAR_RIGHT_CURLY_BRACE:A,CHAR_RIGHT_PARENTHESES:y,CHAR_RIGHT_SQUARE_BRACKET:R}=n(86),m=e=>e===p||e===s,_=e=>{!0!==e.isPrefix&&(e.depth=e.isGlobstar?1/0:1)};e.exports=(e,t)=>{const n=t||{},E=e.length-1,C=!0===n.parts||!0===n.scanToEnd,b=[],x=[],v=[];let S,w,H=e,T=-1,L=0,k=0,O=!1,$=!1,N=!1,I=!1,B=!1,M=!1,P=!1,D=!1,U=!1,G=0,j={value:"",depth:0,isGlob:!1};const K=()=>T>=E,F=()=>(S=w,H.charCodeAt(++T));for(;T0&&(Q=H.slice(0,L),H=H.slice(L),k-=L),W&&!0===N&&k>0?(W=H.slice(0,k),X=H.slice(k)):!0===N?(W="",X=H):W=H,W&&""!==W&&"/"!==W&&W!==H&&m(W.charCodeAt(W.length-1))&&(W=W.slice(0,-1)),!0===n.unescape&&(X&&(X=o.removeBackslashes(X)),W&&!0===P&&(W=o.removeBackslashes(W)));const q={prefix:Q,input:e,start:L,base:W,glob:X,isBrace:O,isBracket:$,isGlob:N,isExtglob:I,isGlobstar:B,negated:D};if(!0===n.tokens&&(q.maxDepth=0,m(w)||x.push(j),q.tokens=x),!0===n.parts||!0===n.tokens){let t;for(let o=0;o{const o=n(622),r="win32"===process.platform,{REGEX_BACKSLASH:a,REGEX_REMOVE_BACKSLASH:s,REGEX_SPECIAL_CHARS:i,REGEX_SPECIAL_CHARS_GLOBAL:l}=n(86);t.isObject=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),t.hasRegexChars=e=>i.test(e),t.isRegexChar=e=>1===e.length&&t.hasRegexChars(e),t.escapeRegex=e=>e.replace(l,"\\$1"),t.toPosixSlashes=e=>e.replace(a,"/"),t.removeBackslashes=e=>e.replace(s,e=>"\\"===e?"":e),t.supportsLookbehinds=()=>{const e=process.version.slice(1).split(".").map(Number);return 3===e.length&&e[0]>=9||8===e[0]&&e[1]>=10},t.isWindows=e=>e&&"boolean"==typeof e.windows?e.windows:!0===r||"\\"===o.sep,t.escapeLast=(e,n,o)=>{const r=e.lastIndexOf(n,o);return-1===r?e:"\\"===e[r-1]?t.escapeLast(e,n,r-1):`${e.slice(0,r)}\\${e.slice(r)}`},t.removePrefix=(e,t={})=>{let n=e;return n.startsWith("./")&&(n=n.slice(2),t.prefix="./"),n},t.wrapOutput=(e,t={},n={})=>{let o=`${n.contains?"":"^"}(?:${e})${n.contains?"":"$"}`;return!0===t.negated&&(o=`(?:^(?!${o}).*$)`),o}},615:(e,t,n)=>{ 20 | /*! 21 | * to-regex-range 22 | * 23 | * Copyright (c) 2015-present, Jon Schlinkert. 24 | * Released under the MIT License. 25 | */ 26 | const o=n(761),r=(e,t,n)=>{if(!1===o(e))throw new TypeError("toRegexRange: expected the first argument to be a number");if(void 0===t||e===t)return String(e);if(!1===o(t))throw new TypeError("toRegexRange: expected the second argument to be a number.");let a={relaxZeros:!0,...n};"boolean"==typeof a.strictZeros&&(a.relaxZeros=!1===a.strictZeros);let l=e+":"+t+"="+String(a.relaxZeros)+String(a.shorthand)+String(a.capture)+String(a.wrap);if(r.cache.hasOwnProperty(l))return r.cache[l].result;let u=Math.min(e,t),p=Math.max(e,t);if(1===Math.abs(u-p)){let n=e+"|"+t;return a.capture?`(${n})`:!1===a.wrap?n:`(?:${n})`}let c=h(e)||h(t),f={min:e,max:t,a:u,b:p},d=[],g=[];if(c&&(f.isPadded=c,f.maxLen=String(f.max).length),u<0){g=s(p<0?Math.abs(p):1,Math.abs(u),f,a),u=f.a=0}return p>=0&&(d=s(u,p,f,a)),f.negatives=g,f.positives=d,f.result=function(e,t,n){let o=i(e,t,"-",!1,n)||[],r=i(t,e,"",!1,n)||[],a=i(e,t,"-?",!0,n)||[];return o.concat(a).concat(r).join("|")}(g,d,a),!0===a.capture?f.result=`(${f.result})`:!1!==a.wrap&&d.length+g.length>1&&(f.result=`(?:${f.result})`),r.cache[l]=f,f.result};function a(e,t,n){if(e===t)return{pattern:e,count:[],digits:0};let o=function(e,t){let n=[];for(let o=0;o1&&r.count.pop(),r.count.push(l.count[0]),r.string=r.pattern+f(r.count),u=t+1)}return i}function i(e,t,n,o,r){let a=[];for(let r of e){let{string:e}=r;o||u(t,"string",e)||a.push(n+e),o&&u(t,"string",e)&&a.push(n+e)}return a}function l(e,t){return e>t?1:t>e?-1:0}function u(e,t,n){return e.some(e=>e[t]===n)}function p(e,t){return Number(String(e).slice(0,-t)+"9".repeat(t))}function c(e,t){return e-e%Math.pow(10,t)}function f(e){let[t=0,n=""]=e;return n||t>1?`{${t+(n?","+n:"")}}`:""}function d(e,t,n){return`[${e}${t-e==1?"":"-"}${t}]`}function h(e){return/^-?(0+)\d/.test(e)}function g(e,t,n){if(!t.isPadded)return e;let o=Math.abs(t.maxLen-String(e).length),r=!1!==n.relaxZeros;switch(o){case 0:return"";case 1:return r?"0?":"0";case 2:return r?"0{0,2}":"00";default:return r?`0{0,${o}}`:`0{${o}}`}}r.cache={},r.clearCache=()=>r.cache={},e.exports=r},594:e=>{e.exports=require("@yarnpkg/cli")},966:e=>{e.exports=require("@yarnpkg/core")},42:e=>{e.exports=require("clipanion")},87:e=>{e.exports=require("os")},622:e=>{e.exports=require("path")},669:e=>{e.exports=require("util")},440:e=>{e.exports=require("yup")}},t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={exports:{}};return e[o](r,r.exports,n),r.exports}return n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n(115)})(); 27 | return plugin; 28 | } 29 | }; --------------------------------------------------------------------------------