@teambit/workspace 0.0.647 → 0.0.651

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/{__preview-1644549681149.js → __preview-1645365357220.js} +0 -0
  2. package/component-config-file/component-config-file.ts +40 -6
  3. package/dist/capsule.cmd.d.ts +0 -1
  4. package/dist/capsule.cmd.js +0 -4
  5. package/dist/capsule.cmd.js.map +1 -1
  6. package/dist/component-config-file/component-config-file.d.ts +7 -3
  7. package/dist/component-config-file/component-config-file.js +46 -6
  8. package/dist/component-config-file/component-config-file.js.map +1 -1
  9. package/dist/eject-conf.cmd.js +1 -1
  10. package/dist/eject-conf.cmd.js.map +1 -1
  11. package/dist/envs-subcommands/envs-replace.cmd.d.ts +11 -0
  12. package/dist/envs-subcommands/envs-replace.cmd.js +56 -0
  13. package/dist/envs-subcommands/envs-replace.cmd.js.map +1 -0
  14. package/dist/envs-subcommands/envs-set.cmd.js +0 -1
  15. package/dist/envs-subcommands/envs-set.cmd.js.map +1 -1
  16. package/dist/pattern.cmd.js +2 -2
  17. package/dist/pattern.cmd.js.map +1 -1
  18. package/dist/tag-cmd.d.ts +1 -1
  19. package/dist/tag-cmd.js +11 -1
  20. package/dist/tag-cmd.js.map +1 -1
  21. package/dist/ui/workspace/workspace-model.d.ts +10 -1
  22. package/dist/ui/workspace/workspace-model.js +25 -3
  23. package/dist/ui/workspace/workspace-model.js.map +1 -1
  24. package/dist/workspace.d.ts +11 -3
  25. package/dist/workspace.js +94 -30
  26. package/dist/workspace.js.map +1 -1
  27. package/dist/workspace.provider.js +13 -2
  28. package/dist/workspace.provider.js.map +1 -1
  29. package/eject-conf.cmd.tsx +1 -1
  30. package/envs-subcommands/envs-replace.cmd.ts +21 -0
  31. package/envs-subcommands/envs-set.cmd.ts +0 -1
  32. package/package-tar/teambit-workspace-0.0.651.tgz +0 -0
  33. package/package.json +50 -49
  34. package/ui/workspace/workspace-model.ts +14 -3
  35. package/package-tar/teambit-workspace-0.0.647.tgz +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["tag-cmd.ts"],"names":["Tag","BASE_DOCS_DOMAIN","report","id","message","ver","all","snapped","patch","minor","major","preRelease","force","verbose","ignoreUnresolvedDependencies","ignoreIssues","ignoreNewestVersion","skipTests","skipAutoTag","scope","build","soft","persist","disableDeployPipeline","disableTagPipeline","forceDeploy","incrementBy","BUILD_ON_CI","Boolean","getVersion","length","GeneralError","secondArg","semver","valid","disableTagAndSnapPipelines","releaseFlags","filter","x","releaseType","DEFAULT_BIT_RELEASE_TYPE","includeImported","params","ids","exactVersion","results","chalk","yellow","NOTHING_TO_TAG_MSG","taggedComponents","autoTaggedResults","warnings","newComponents","changedComponents","component","searchWithoutVersion","addedComponents","autoTaggedCount","warningsOutput","join","tagExplanationPersist","tagExplanationSoft","tagExplanation","isSoftTag","outputComponents","comps","map","componentOutput","toString","autoTag","result","triggeredBy","searchWithoutScopeAndVersion","autoTagComp","a","AUTO_TAGGED_MSG","publishOutput","publishedPackages","successTitle","green","successCompsStr","successOutput","softTagPrefix","outputIfExists","label","explanation","components","underline","newDesc","changedDesc","softTagClarification","bold"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAMA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEO,MAAMA,GAAN,CAA6B;AAAA;AAAA,kDAC3B,aAD2B;AAAA,mDAE1B,aAF0B;AAAA,8DAGf,4CAHe;AAAA,yDAInB;AAC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8B,EAAG,QADhG,CADA,GAIAD,cAJA,GAKAqB,cAAc,CAAC,gBAAD,EAAmBK,OAAnB,EAA4BhC,eAA5B,CALd,GAMA2B,cAAc,CAAC,oBAAD,EAAuBM,WAAvB,EAAoCpC,iBAApC,CANd,GAOAuB,aAAa,EAPb,GAQAc,oBATF;AAWD;;AAtOiC","sourcesContent":["import chalk from 'chalk';\nimport semver, { ReleaseType } from 'semver';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { tagAction } from '@teambit/legacy/dist/api/consumer';\nimport {\n TagResults,\n NOTHING_TO_TAG_MSG,\n AUTO_TAGGED_MSG,\n BasicTagParams,\n} from '@teambit/legacy/dist/api/consumer/lib/tag';\nimport { isString } from '@teambit/legacy/dist/utils';\nimport { DEFAULT_BIT_RELEASE_TYPE, BASE_DOCS_DOMAIN, WILDCARD_HELP } from '@teambit/legacy/dist/constants';\nimport GeneralError from '@teambit/legacy/dist/error/general-error';\nimport { isFeatureEnabled, BUILD_ON_CI } from '@teambit/legacy/dist/api/consumer/lib/feature-toggle';\n\nexport class Tag implements Command {\n name = 'tag [id...]';\n group = 'development';\n shortDescription = 'record component changes and lock versions';\n description = `record component changes and lock versions.\nif component ids are entered, you can specify a version per id using \"@\" sign, e.g. bit tag foo@1.0.0 bar@minor baz@major\nhttps://${BASE_DOCS_DOMAIN}/docs/tag-component-version\n${WILDCARD_HELP('tag')}`;\n alias = 't';\n loader = true;\n options = [\n ['m', 'message <message>', 'log message describing the user changes'],\n ['a', 'all [version]', 'tag all new and modified components'],\n ['s', 'scope [version]', 'tag all components of the current scope'],\n ['', 'snapped [version]', 'tag components that their head is a snap (not a tag)'],\n ['', 'ver <version>', 'tag specified components with the given version'],\n ['p', 'patch', 'increment the patch version number'],\n ['', 'minor', 'increment the minor version number'],\n ['', 'major', 'increment the major version number'],\n ['', 'pre-release [identifier]', 'EXPERIMENTAL. increment a pre-release version (e.g. 1.0.0-dev.1)'],\n ['f', 'force', 'force-tag even if tests are failing and even when component has not changed'],\n ['v', 'verbose', 'show specs output on failure'],\n ['', 'ignore-unresolved-dependencies', 'DEPRECATED. use --ignore-issues instead'],\n ['i', 'ignore-issues', 'ignore component issues (shown in \"bit status\" as \"issues found\")'],\n ['I', 'ignore-newest-version', 'ignore existing of newer versions (default = false)'],\n ['', 'skip-tests', 'skip running component tests during tag process'],\n ['', 'skip-auto-tag', 'skip auto tagging dependents'],\n ['b', 'build', 'EXPERIMENTAL. not needed for now. run the pipeline build and complete the tag'],\n ['', 'soft', 'do not persist. only keep note of the changes to be made'],\n ['', 'persist', 'persist the changes generated by --soft tag'],\n ['', 'disable-deploy-pipeline', 'DEPRECATED. use --disable-tag-pipeline instead'],\n ['', 'disable-tag-pipeline', 'skip the tag pipeline to avoid publishing the components'],\n ['', 'force-deploy', 'run the tag pipeline although the build failed'],\n [\n '',\n 'increment-by <number>',\n '(default to 1) increment semver flag (patch/minor/major) by. e.g. incrementing patch by 2: 0.0.1 -> 0.0.3.',\n ],\n ] as CommandOptions;\n migration = true;\n remoteOp = true; // In case a compiler / tester is not installed\n\n // eslint-disable-next-line complexity\n async report(\n [id = []]: [string[]],\n {\n message = '',\n ver,\n all = false,\n snapped = false,\n patch,\n minor,\n major,\n preRelease,\n force = false,\n verbose = false,\n ignoreUnresolvedDependencies,\n ignoreIssues = false,\n ignoreNewestVersion = false,\n skipTests = false,\n skipAutoTag = false,\n scope,\n build,\n soft = false,\n persist = false,\n disableDeployPipeline = false,\n disableTagPipeline = false,\n forceDeploy = false,\n incrementBy = 1,\n }: {\n all?: boolean | string;\n snapped?: boolean | string;\n ver?: string;\n patch?: boolean;\n minor?: boolean;\n major?: boolean;\n ignoreUnresolvedDependencies?: boolean;\n ignoreIssues?: boolean;\n scope?: string | boolean;\n incrementBy?: number;\n disableDeployPipeline?: boolean;\n disableTagPipeline?: boolean;\n } & Partial<BasicTagParams>\n ): Promise<string> {\n build = isFeatureEnabled(BUILD_ON_CI) ? Boolean(build) : true;\n if (soft) build = false;\n function getVersion(): string | undefined {\n if (scope && isString(scope)) return scope;\n if (all && isString(all)) return all;\n if (snapped && isString(snapped)) return snapped;\n return ver;\n }\n\n if (!id.length && !all && !snapped && !scope && !persist) {\n throw new GeneralError('missing [id]. to tag all components, please use --all flag');\n }\n if (id.length && all) {\n throw new GeneralError(\n 'you can use either a specific component [id] to tag a particular component or --all flag to tag them all'\n );\n }\n if (typeof ignoreUnresolvedDependencies === 'boolean') {\n ignoreIssues = ignoreUnresolvedDependencies;\n }\n if (id.length === 2) {\n const secondArg = id[1];\n // previously, the synopsis of this command was `bit tag [id] [version]`, show a descriptive\n // error when users still use it.\n if (semver.valid(secondArg)) {\n throw new GeneralError(\n `seems like you entered a version as the second arg, this is not supported anymore, please use \"@\" sign or --ver flag instead`\n );\n }\n }\n const disableTagAndSnapPipelines = disableTagPipeline || disableDeployPipeline;\n if (disableTagAndSnapPipelines && forceDeploy) {\n throw new GeneralError('you can use either force-deploy or disable-tag-pipeline, but not both');\n }\n if (all && persist) {\n throw new GeneralError('you can use either --all or --persist, but not both');\n }\n\n const releaseFlags = [patch, minor, major, preRelease].filter((x) => x);\n if (releaseFlags.length > 1) {\n throw new GeneralError('you can use only one of the following - patch, minor, major, pre-release');\n }\n\n let releaseType: ReleaseType = DEFAULT_BIT_RELEASE_TYPE;\n const includeImported = Boolean(scope && all);\n\n if (major) releaseType = 'major';\n else if (minor) releaseType = 'minor';\n else if (patch) releaseType = 'patch';\n else if (preRelease) releaseType = 'prerelease';\n\n const params = {\n ids: id,\n all: Boolean(all),\n snapped: Boolean(snapped),\n message,\n exactVersion: getVersion(),\n releaseType,\n preRelease: typeof preRelease === 'string' ? preRelease : '',\n force,\n verbose,\n ignoreIssues,\n ignoreNewestVersion,\n skipTests,\n skipAutoTag,\n build,\n soft,\n persist,\n scope,\n includeImported,\n disableTagAndSnapPipelines,\n forceDeploy,\n incrementBy,\n };\n\n const results = await tagAction(params);\n if (!results) return chalk.yellow(NOTHING_TO_TAG_MSG);\n const { taggedComponents, autoTaggedResults, warnings, newComponents }: TagResults = results;\n const changedComponents = taggedComponents.filter((component) => !newComponents.searchWithoutVersion(component.id));\n const addedComponents = taggedComponents.filter((component) => newComponents.searchWithoutVersion(component.id));\n const autoTaggedCount = autoTaggedResults ? autoTaggedResults.length : 0;\n\n const warningsOutput = warnings && warnings.length ? `${chalk.yellow(warnings.join('\\n'))}\\n\\n` : '';\n const tagExplanationPersist = `\\n(use \"bit export [collection]\" to push these components to a remote\")\n(use \"bit untag\" to unstage versions)\\n`;\n const tagExplanationSoft = `\\n(use \"bit tag --persist\" to persist the changes\")\n(use \"bit untag --soft\" to remove the soft-tags)\\n`;\n\n const tagExplanation = results.isSoftTag ? tagExplanationSoft : tagExplanationPersist;\n\n const outputComponents = (comps) => {\n return comps\n .map((component) => {\n let componentOutput = ` > ${component.id.toString()}`;\n const autoTag = autoTaggedResults.filter((result) =>\n result.triggeredBy.searchWithoutScopeAndVersion(component.id)\n );\n if (autoTag.length) {\n const autoTagComp = autoTag.map((a) => a.component.id.toString());\n componentOutput += `\\n ${AUTO_TAGGED_MSG}:\n ${autoTagComp.join('\\n ')}`;\n }\n return componentOutput;\n })\n .join('\\n');\n };\n\n const publishOutput = () => {\n const { publishedPackages } = results;\n if (!publishedPackages || !publishedPackages.length) return '';\n const successTitle = `\\n\\n${chalk.green(\n `published the following ${publishedPackages.length} component(s) successfully\\n`\n )}`;\n const successCompsStr = publishedPackages.join('\\n');\n const successOutput = successCompsStr ? successTitle + successCompsStr : '';\n return successOutput;\n };\n\n const softTagPrefix = results.isSoftTag ? 'soft-tagged ' : '';\n const outputIfExists = (label, explanation, components) => {\n if (!components.length) return '';\n return `\\n${chalk.underline(softTagPrefix + label)}\\n(${explanation})\\n${outputComponents(components)}\\n`;\n };\n\n const newDesc = results.isSoftTag\n ? 'set to be tagged first version for components'\n : 'first version for components';\n const changedDesc = results.isSoftTag\n ? 'components that set to get a version bump'\n : 'components that got a version bump';\n const softTagClarification = results.isSoftTag\n ? chalk.bold(\n 'keep in mind that this is a soft-tag (changes recorded to be tagged), to persist the changes use --persist flag'\n )\n : '';\n return (\n warningsOutput +\n chalk.green(\n `${taggedComponents.length + autoTaggedCount} component(s) ${results.isSoftTag ? 'soft-' : ''}tagged`\n ) +\n tagExplanation +\n outputIfExists('new components', newDesc, addedComponents) +\n outputIfExists('changed components', changedDesc, changedComponents) +\n publishOutput() +\n softTagClarification\n );\n }\n}\n"]}
1
+ {"version":3,"sources":["tag-cmd.ts"],"names":["Tag","BASE_DOCS_DOMAIN","report","id","message","ver","all","editor","snapped","patch","minor","major","preRelease","force","verbose","ignoreUnresolvedDependencies","ignoreIssues","ignoreNewestVersion","skipTests","skipAutoTag","scope","build","soft","persist","disableDeployPipeline","disableTagPipeline","forceDeploy","incrementBy","BUILD_ON_CI","Boolean","getVersion","length","GeneralError","secondArg","semver","valid","disableTagAndSnapPipelines","releaseFlags","filter","x","releaseType","DEFAULT_BIT_RELEASE_TYPE","includeImported","params","ids","exactVersion","results","chalk","yellow","NOTHING_TO_TAG_MSG","taggedComponents","autoTaggedResults","warnings","newComponents","changedComponents","component","searchWithoutVersion","addedComponents","autoTaggedCount","warningsOutput","join","tagExplanationPersist","tagExplanationSoft","tagExplanation","isSoftTag","outputComponents","comps","map","componentOutput","toString","autoTag","result","triggeredBy","searchWithoutScopeAndVersion","autoTagComp","a","AUTO_TAGGED_MSG","publishOutput","publishedPackages","successTitle","green","successCompsStr","successOutput","softTagPrefix","outputIfExists","label","explanation","components","underline","newDesc","changedDesc","softTagClarification","bold"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAMA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;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AAIgB,iBAAMyC,SAAN,CAAgBL,aAAa,GAAGE,KAAhC,CAAuC,MAAKC,WAAY,MAAKrB,gBAAgB,CAACsB,UAAD,CAAa,IAAtG;AACD,KAHD;;AAKA,UAAME,OAAO,GAAG3C,OAAO,CAACkB,SAAR,GACZ,+CADY,GAEZ,8BAFJ;AAGA,UAAM0B,WAAW,GAAG5C,OAAO,CAACkB,SAAR,GAChB,2CADgB,GAEhB,oCAFJ;AAGA,UAAM2B,oBAAoB,GAAG7C,OAAO,CAACkB,SAAR,GACzBjB,iBAAM6C,IAAN,CACE,iHADF,CADyB,GAIzB,EAJJ;AAKA,WACEjC,cAAc,GACdZ,iBAAMiC,KAAN,CACG,GAAE9B,gBAAgB,CAACnB,MAAjB,GAA0B2B,eAAgB,iBAAgBZ,OAAO,CAACkB,SAAR,GAAoB,OAApB,GAA8B,EAAG,QADhG,CADA,GAIAD,cAJA,GAKAqB,cAAc,CAAC,gBAAD,EAAmBK,OAAnB,EAA4BhC,eAA5B,CALd,GAMA2B,cAAc,CAAC,oBAAD,EAAuBM,WAAvB,EAAoCpC,iBAApC,CANd,GAOAuB,aAAa,EAPb,GAQAc,oBATF;AAWD;;AAnPiC","sourcesContent":["import chalk from 'chalk';\nimport semver, { ReleaseType } from 'semver';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { tagAction } from '@teambit/legacy/dist/api/consumer';\nimport {\n TagResults,\n NOTHING_TO_TAG_MSG,\n AUTO_TAGGED_MSG,\n BasicTagParams,\n} from '@teambit/legacy/dist/api/consumer/lib/tag';\nimport { isString } from '@teambit/legacy/dist/utils';\nimport { DEFAULT_BIT_RELEASE_TYPE, BASE_DOCS_DOMAIN, WILDCARD_HELP } from '@teambit/legacy/dist/constants';\nimport GeneralError from '@teambit/legacy/dist/error/general-error';\nimport { isFeatureEnabled, BUILD_ON_CI } from '@teambit/legacy/dist/api/consumer/lib/feature-toggle';\n\nexport class Tag implements Command {\n name = 'tag [id...]';\n group = 'development';\n shortDescription = 'record component changes and lock versions';\n description = `record component changes and lock versions.\nif component ids are entered, you can specify a version per id using \"@\" sign, e.g. bit tag foo@1.0.0 bar@minor baz@major\nhttps://${BASE_DOCS_DOMAIN}/docs/tag-component-version\n${WILDCARD_HELP('tag')}`;\n alias = 't';\n loader = true;\n options = [\n ['m', 'message <message>', 'log message describing the user changes'],\n ['a', 'all [version]', 'tag all new and modified components'],\n ['s', 'scope [version]', 'tag all components of the current scope'],\n [\n '',\n 'editor [editor]',\n 'EXPERIMENTAL. open an editor to edit the tag messages per component, optionally specify the editor-name, default to vim',\n ],\n ['', 'snapped [version]', 'tag components that their head is a snap (not a tag)'],\n ['', 'ver <version>', 'tag specified components with the given version'],\n ['p', 'patch', 'increment the patch version number'],\n ['', 'minor', 'increment the minor version number'],\n ['', 'major', 'increment the major version number'],\n ['', 'pre-release [identifier]', 'EXPERIMENTAL. increment a pre-release version (e.g. 1.0.0-dev.1)'],\n ['f', 'force', 'force-tag even if tests are failing and even when component has not changed'],\n ['v', 'verbose', 'show specs output on failure'],\n ['', 'ignore-unresolved-dependencies', 'DEPRECATED. use --ignore-issues instead'],\n ['i', 'ignore-issues', 'ignore component issues (shown in \"bit status\" as \"issues found\")'],\n ['I', 'ignore-newest-version', 'ignore existing of newer versions (default = false)'],\n ['', 'skip-tests', 'skip running component tests during tag process'],\n ['', 'skip-auto-tag', 'skip auto tagging dependents'],\n ['b', 'build', 'EXPERIMENTAL. not needed for now. run the pipeline build and complete the tag'],\n ['', 'soft', 'do not persist. only keep note of the changes to be made'],\n ['', 'persist', 'persist the changes generated by --soft tag'],\n ['', 'disable-deploy-pipeline', 'DEPRECATED. use --disable-tag-pipeline instead'],\n ['', 'disable-tag-pipeline', 'skip the tag pipeline to avoid publishing the components'],\n ['', 'force-deploy', 'run the tag pipeline although the build failed'],\n [\n '',\n 'increment-by <number>',\n '(default to 1) increment semver flag (patch/minor/major) by. e.g. incrementing patch by 2: 0.0.1 -> 0.0.3.',\n ],\n ] as CommandOptions;\n migration = true;\n remoteOp = true; // In case a compiler / tester is not installed\n\n // eslint-disable-next-line complexity\n async report(\n [id = []]: [string[]],\n {\n message = '',\n ver,\n all = false,\n editor = '',\n snapped = false,\n patch,\n minor,\n major,\n preRelease,\n force = false,\n verbose = false,\n ignoreUnresolvedDependencies,\n ignoreIssues = false,\n ignoreNewestVersion = false,\n skipTests = false,\n skipAutoTag = false,\n scope,\n build,\n soft = false,\n persist = false,\n disableDeployPipeline = false,\n disableTagPipeline = false,\n forceDeploy = false,\n incrementBy = 1,\n }: {\n all?: boolean | string;\n snapped?: boolean | string;\n ver?: string;\n patch?: boolean;\n minor?: boolean;\n major?: boolean;\n ignoreUnresolvedDependencies?: boolean;\n ignoreIssues?: boolean;\n scope?: string | boolean;\n incrementBy?: number;\n disableDeployPipeline?: boolean;\n disableTagPipeline?: boolean;\n } & Partial<BasicTagParams>\n ): Promise<string> {\n build = isFeatureEnabled(BUILD_ON_CI) ? Boolean(build) : true;\n if (soft) build = false;\n function getVersion(): string | undefined {\n if (scope && isString(scope)) return scope;\n if (all && isString(all)) return all;\n if (snapped && isString(snapped)) return snapped;\n return ver;\n }\n\n if (!id.length && !all && !snapped && !scope && !persist) {\n throw new GeneralError('missing [id]. to tag all components, please use --all flag');\n }\n if (id.length && all) {\n throw new GeneralError(\n 'you can use either a specific component [id] to tag a particular component or --all flag to tag them all'\n );\n }\n if (typeof ignoreUnresolvedDependencies === 'boolean') {\n ignoreIssues = ignoreUnresolvedDependencies;\n }\n if (id.length === 2) {\n const secondArg = id[1];\n // previously, the synopsis of this command was `bit tag [id] [version]`, show a descriptive\n // error when users still use it.\n if (semver.valid(secondArg)) {\n throw new GeneralError(\n `seems like you entered a version as the second arg, this is not supported anymore, please use \"@\" sign or --ver flag instead`\n );\n }\n }\n const disableTagAndSnapPipelines = disableTagPipeline || disableDeployPipeline;\n if (disableTagAndSnapPipelines && forceDeploy) {\n throw new GeneralError('you can use either force-deploy or disable-tag-pipeline, but not both');\n }\n if (all && persist) {\n throw new GeneralError('you can use either --all or --persist, but not both');\n }\n if (editor && persist) {\n throw new GeneralError('you can use either --editor or --persist, but not both');\n }\n if (editor && message) {\n throw new GeneralError('you can use either --editor or --message, but not both');\n }\n\n const releaseFlags = [patch, minor, major, preRelease].filter((x) => x);\n if (releaseFlags.length > 1) {\n throw new GeneralError('you can use only one of the following - patch, minor, major, pre-release');\n }\n\n let releaseType: ReleaseType = DEFAULT_BIT_RELEASE_TYPE;\n const includeImported = Boolean(scope && all);\n\n if (major) releaseType = 'major';\n else if (minor) releaseType = 'minor';\n else if (patch) releaseType = 'patch';\n else if (preRelease) releaseType = 'prerelease';\n\n const params = {\n ids: id,\n all: Boolean(all),\n snapped: Boolean(snapped),\n editor,\n message,\n exactVersion: getVersion(),\n releaseType,\n preRelease: typeof preRelease === 'string' ? preRelease : '',\n force,\n verbose,\n ignoreIssues,\n ignoreNewestVersion,\n skipTests,\n skipAutoTag,\n build,\n soft,\n persist,\n scope,\n includeImported,\n disableTagAndSnapPipelines,\n forceDeploy,\n incrementBy,\n };\n\n const results = await tagAction(params);\n if (!results) return chalk.yellow(NOTHING_TO_TAG_MSG);\n const { taggedComponents, autoTaggedResults, warnings, newComponents }: TagResults = results;\n const changedComponents = taggedComponents.filter((component) => !newComponents.searchWithoutVersion(component.id));\n const addedComponents = taggedComponents.filter((component) => newComponents.searchWithoutVersion(component.id));\n const autoTaggedCount = autoTaggedResults ? autoTaggedResults.length : 0;\n\n const warningsOutput = warnings && warnings.length ? `${chalk.yellow(warnings.join('\\n'))}\\n\\n` : '';\n const tagExplanationPersist = `\\n(use \"bit export [collection]\" to push these components to a remote\")\n(use \"bit untag\" to unstage versions)\\n`;\n const tagExplanationSoft = `\\n(use \"bit tag --persist\" to persist the changes\")\n(use \"bit untag --soft\" to remove the soft-tags)\\n`;\n\n const tagExplanation = results.isSoftTag ? tagExplanationSoft : tagExplanationPersist;\n\n const outputComponents = (comps) => {\n return comps\n .map((component) => {\n let componentOutput = ` > ${component.id.toString()}`;\n const autoTag = autoTaggedResults.filter((result) =>\n result.triggeredBy.searchWithoutScopeAndVersion(component.id)\n );\n if (autoTag.length) {\n const autoTagComp = autoTag.map((a) => a.component.id.toString());\n componentOutput += `\\n ${AUTO_TAGGED_MSG}:\n ${autoTagComp.join('\\n ')}`;\n }\n return componentOutput;\n })\n .join('\\n');\n };\n\n const publishOutput = () => {\n const { publishedPackages } = results;\n if (!publishedPackages || !publishedPackages.length) return '';\n const successTitle = `\\n\\n${chalk.green(\n `published the following ${publishedPackages.length} component(s) successfully\\n`\n )}`;\n const successCompsStr = publishedPackages.join('\\n');\n const successOutput = successCompsStr ? successTitle + successCompsStr : '';\n return successOutput;\n };\n\n const softTagPrefix = results.isSoftTag ? 'soft-tagged ' : '';\n const outputIfExists = (label, explanation, components) => {\n if (!components.length) return '';\n return `\\n${chalk.underline(softTagPrefix + label)}\\n(${explanation})\\n${outputComponents(components)}\\n`;\n };\n\n const newDesc = results.isSoftTag\n ? 'set to be tagged first version for components'\n : 'first version for components';\n const changedDesc = results.isSoftTag\n ? 'components that set to get a version bump'\n : 'components that got a version bump';\n const softTagClarification = results.isSoftTag\n ? chalk.bold(\n 'keep in mind that this is a soft-tag (changes recorded to be tagged), to persist the changes use --persist flag'\n )\n : '';\n return (\n warningsOutput +\n chalk.green(\n `${taggedComponents.length + autoTaggedCount} component(s) ${results.isSoftTag ? 'soft-' : ''}tagged`\n ) +\n tagExplanation +\n outputIfExists('new components', newDesc, addedComponents) +\n outputIfExists('changed components', changedDesc, changedComponents) +\n publishOutput() +\n softTagClarification\n );\n }\n}\n"]}
@@ -1,4 +1,5 @@
1
1
  import { ComponentID, ComponentModel, ComponentModelProps } from '@teambit/component';
2
+ import { ComponentDescriptor } from '@teambit/component-descriptor';
2
3
  import { DeprecationInfo } from '@teambit/deprecation';
3
4
  import { Descriptor } from '@teambit/envs';
4
5
  import { ComponentStatus } from '../../workspace-component/component-status';
@@ -31,6 +32,10 @@ export declare class Workspace {
31
32
  * components container in the workspace.
32
33
  */
33
34
  readonly components: ComponentModel[];
35
+ /**
36
+ * components contained in the workspace.
37
+ */
38
+ readonly componentDescriptors: ComponentDescriptor[];
34
39
  constructor(
35
40
  /**
36
41
  * name of the workspace.
@@ -47,7 +52,11 @@ export declare class Workspace {
47
52
  /**
48
53
  * components container in the workspace.
49
54
  */
50
- components: ComponentModel[]);
55
+ components: ComponentModel[],
56
+ /**
57
+ * components contained in the workspace.
58
+ */
59
+ componentDescriptors: ComponentDescriptor[]);
51
60
  /**
52
61
  * return a component from the workspace.
53
62
  */
@@ -15,6 +15,16 @@ function _component() {
15
15
  return data;
16
16
  }
17
17
 
18
+ function _componentDescriptor() {
19
+ const data = require("@teambit/component-descriptor");
20
+
21
+ _componentDescriptor = function () {
22
+ return data;
23
+ };
24
+
25
+ return data;
26
+ }
27
+
18
28
  // import { ComponentMeta } from '@teambit/component';
19
29
  class Workspace {
20
30
  constructor(
@@ -33,11 +43,16 @@ class Workspace {
33
43
  /**
34
44
  * components container in the workspace.
35
45
  */
36
- components) {
46
+ components,
47
+ /**
48
+ * components contained in the workspace.
49
+ */
50
+ componentDescriptors) {
37
51
  this.name = name;
38
52
  this.path = path;
39
53
  this.icon = icon;
40
54
  this.components = components;
55
+ this.componentDescriptors = componentDescriptors;
41
56
  }
42
57
  /**
43
58
  * return a component from the workspace.
@@ -54,13 +69,20 @@ class Workspace {
54
69
  components,
55
70
  icon
56
71
  }) {
72
+ const componentDescriptors = components.map(component => {
73
+ const id = _component().ComponentID.fromObject(component.id);
74
+
75
+ return _componentDescriptor().ComponentDescriptor.fromObject({
76
+ id: id.toString()
77
+ });
78
+ });
57
79
  return new Workspace(name, path, icon, components.map(value => {
58
80
  return _component().ComponentModel.from(value);
59
- }));
81
+ }), componentDescriptors);
60
82
  }
61
83
 
62
84
  static empty() {
63
- return new Workspace('', '', '', []);
85
+ return new Workspace('', '', '', [], []);
64
86
  }
65
87
 
66
88
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["workspace-model.ts"],"names":["Workspace","constructor","name","path","icon","components","getComponent","id","find","component","fullName","from","map","value","ComponentModel","empty"],"mappings":";;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AADA;AAqBO,MAAMA,SAAN,CAAgB;AACrBC,EAAAA,WAAW;AACT;AACJ;AACA;AACaC,EAAAA,IAJA;AAMT;AACJ;AACA;AACaC,EAAAA,IATA;AAWT;AACJ;AACA;AACaC,EAAAA,IAdA;AAgBT;AACJ;AACA;AACaC,EAAAA,UAnBA,EAoBT;AAAA,SAhBSH,IAgBT,GAhBSA,IAgBT;AAAA,SAXSC,IAWT,GAXSA,IAWT;AAAA,SANSC,IAMT,GANSA,IAMT;AAAA,SADSC,UACT,GADSA,UACT;AAAE;AAEJ;AACF;AACA;;;AACEC,EAAAA,YAAY,CAACC,EAAD,EAAkB;AAC5B,WAAO,KAAKF,UAAL,CAAgBG,IAAhB,CAAsBC,SAAD,IAAeA,SAAS,CAACF,EAAV,CAAaG,QAAb,KAA0BH,EAAE,CAACG,QAAjE,CAAP;AACD;;AAEU,SAAJC,IAAI,CAAC;AAAET,IAAAA,IAAF;AAAQC,IAAAA,IAAR;AAAcE,IAAAA,UAAd;AAA0BD,IAAAA;AAA1B,GAAD,EAAmD;AAC5D,WAAO,IAAIJ,SAAJ,CACLE,IADK,EAELC,IAFK,EAGLC,IAHK,EAILC,UAAU,CAACO,GAAX,CAAgBC,KAAD,IAAW;AACxB,aAAOC,4BAAeH,IAAf,CAAoBE,KAApB,CAAP;AACD,KAFD,CAJK,CAAP;AAQD;;AAEW,SAALE,KAAK,GAAG;AACb,WAAO,IAAIf,SAAJ,CAAc,EAAd,EAAkB,EAAlB,EAAsB,EAAtB,EAA0B,EAA1B,CAAP;AACD;;AA3CoB","sourcesContent":["// import { ComponentMeta } from '@teambit/component';\nimport { ComponentID, ComponentModel, ComponentModelProps } from '@teambit/component';\nimport { DeprecationInfo } from '@teambit/deprecation';\nimport { Descriptor } from '@teambit/envs';\n\nimport { ComponentStatus } from '../../workspace-component/component-status';\n\nexport type WorkspaceModelComponent = {\n id: ComponentID;\n status: ComponentStatus;\n deprecation: DeprecationInfo;\n env: Descriptor;\n};\n\nexport type WorkspaceProps = {\n name: string;\n path: string;\n components: ComponentModelProps[];\n icon: string;\n};\n\nexport class Workspace {\n constructor(\n /**\n * name of the workspace.\n */\n readonly name: string,\n\n /**\n * absolute path of the workspace.\n */\n readonly path: string,\n\n /**\n * icon of the workspace.\n */\n readonly icon: string,\n\n /**\n * components container in the workspace.\n */\n readonly components: ComponentModel[]\n ) {}\n\n /**\n * return a component from the workspace.\n */\n getComponent(id: ComponentID) {\n return this.components.find((component) => component.id.fullName === id.fullName);\n }\n\n static from({ name, path, components, icon }: WorkspaceProps) {\n return new Workspace(\n name,\n path,\n icon,\n components.map((value) => {\n return ComponentModel.from(value);\n })\n );\n }\n\n static empty() {\n return new Workspace('', '', '', []);\n }\n}\n"]}
1
+ {"version":3,"sources":["workspace-model.ts"],"names":["Workspace","constructor","name","path","icon","components","componentDescriptors","getComponent","id","find","component","fullName","from","map","ComponentID","fromObject","ComponentDescriptor","toString","value","ComponentModel","empty"],"mappings":";;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAFA;AAsBO,MAAMA,SAAN,CAAgB;AACrBC,EAAAA,WAAW;AACT;AACJ;AACA;AACaC,EAAAA,IAJA;AAMT;AACJ;AACA;AACaC,EAAAA,IATA;AAWT;AACJ;AACA;AACaC,EAAAA,IAdA;AAgBT;AACJ;AACA;AACaC,EAAAA,UAnBA;AAqBT;AACJ;AACA;AACaC,EAAAA,oBAxBA,EAyBT;AAAA,SArBSJ,IAqBT,GArBSA,IAqBT;AAAA,SAhBSC,IAgBT,GAhBSA,IAgBT;AAAA,SAXSC,IAWT,GAXSA,IAWT;AAAA,SANSC,UAMT,GANSA,UAMT;AAAA,SADSC,oBACT,GADSA,oBACT;AAAE;AAEJ;AACF;AACA;;;AACEC,EAAAA,YAAY,CAACC,EAAD,EAAkB;AAC5B,WAAO,KAAKH,UAAL,CAAgBI,IAAhB,CAAsBC,SAAD,IAAeA,SAAS,CAACF,EAAV,CAAaG,QAAb,KAA0BH,EAAE,CAACG,QAAjE,CAAP;AACD;;AAEU,SAAJC,IAAI,CAAC;AAAEV,IAAAA,IAAF;AAAQC,IAAAA,IAAR;AAAcE,IAAAA,UAAd;AAA0BD,IAAAA;AAA1B,GAAD,EAAmD;AAC5D,UAAME,oBAAoB,GAAGD,UAAU,CAACQ,GAAX,CAAgBH,SAAD,IAAe;AACzD,YAAMF,EAAE,GAAGM,yBAAYC,UAAZ,CAAuBL,SAAS,CAACF,EAAjC,CAAX;;AACA,aAAOQ,2CAAoBD,UAApB,CAA+B;AAAEP,QAAAA,EAAE,EAAEA,EAAE,CAACS,QAAH;AAAN,OAA/B,CAAP;AACD,KAH4B,CAA7B;AAIA,WAAO,IAAIjB,SAAJ,CACLE,IADK,EAELC,IAFK,EAGLC,IAHK,EAILC,UAAU,CAACQ,GAAX,CAAgBK,KAAD,IAAW;AACxB,aAAOC,4BAAeP,IAAf,CAAoBM,KAApB,CAAP;AACD,KAFD,CAJK,EAOLZ,oBAPK,CAAP;AASD;;AAEW,SAALc,KAAK,GAAG;AACb,WAAO,IAAIpB,SAAJ,CAAc,EAAd,EAAkB,EAAlB,EAAsB,EAAtB,EAA0B,EAA1B,EAA8B,EAA9B,CAAP;AACD;;AArDoB","sourcesContent":["// import { ComponentMeta } from '@teambit/component';\nimport { ComponentID, ComponentModel, ComponentModelProps } from '@teambit/component';\nimport { ComponentDescriptor } from '@teambit/component-descriptor';\nimport { DeprecationInfo } from '@teambit/deprecation';\nimport { Descriptor } from '@teambit/envs';\n\nimport { ComponentStatus } from '../../workspace-component/component-status';\n\nexport type WorkspaceModelComponent = {\n id: ComponentID;\n status: ComponentStatus;\n deprecation: DeprecationInfo;\n env: Descriptor;\n};\n\nexport type WorkspaceProps = {\n name: string;\n path: string;\n components: ComponentModelProps[];\n icon: string;\n};\n\nexport class Workspace {\n constructor(\n /**\n * name of the workspace.\n */\n readonly name: string,\n\n /**\n * absolute path of the workspace.\n */\n readonly path: string,\n\n /**\n * icon of the workspace.\n */\n readonly icon: string,\n\n /**\n * components container in the workspace.\n */\n readonly components: ComponentModel[],\n\n /**\n * components contained in the workspace.\n */\n readonly componentDescriptors: ComponentDescriptor[]\n ) {}\n\n /**\n * return a component from the workspace.\n */\n getComponent(id: ComponentID) {\n return this.components.find((component) => component.id.fullName === id.fullName);\n }\n\n static from({ name, path, components, icon }: WorkspaceProps) {\n const componentDescriptors = components.map((component) => {\n const id = ComponentID.fromObject(component.id);\n return ComponentDescriptor.fromObject({ id: id.toString() });\n });\n return new Workspace(\n name,\n path,\n icon,\n components.map((value) => {\n return ComponentModel.from(value);\n }),\n componentDescriptors\n );\n }\n\n static empty() {\n return new Workspace('', '', '', [], []);\n }\n}\n"]}
@@ -250,6 +250,7 @@ export declare class Workspace implements ComponentFactory {
250
250
  */
251
251
  load(ids: Array<BitId | string>): Promise<ResolvedComponent[]>;
252
252
  createAspectList(extensionDataList: ExtensionDataList): Promise<AspectList>;
253
+ private extensionDataEntryToAspectEntry;
253
254
  /**
254
255
  * get a component from workspace
255
256
  * @param id component ID
@@ -274,6 +275,9 @@ export declare class Workspace implements ComponentFactory {
274
275
  } | null>;
275
276
  getDefaultExtensions(): ExtensionDataList;
276
277
  ejectConfig(id: ComponentID, options: EjectConfOptions): Promise<EjectConfResult>;
278
+ /**
279
+ * see component-aspect, createAspectListFromLegacy() method for a context why this is needed.
280
+ */
277
281
  private resolveScopeAspectListIds;
278
282
  /**
279
283
  * load components into the workspace through a variants pattern.
@@ -285,7 +289,7 @@ export declare class Workspace implements ComponentFactory {
285
289
  * get component-ids matching the given pattern. a pattern can have multiple patterns separated by a comma.
286
290
  * it supports negate (!) character to exclude ids.
287
291
  */
288
- idsByPattern(pattern: string): Promise<ComponentID[]>;
292
+ idsByPattern(pattern: string, throwForNoMatch?: boolean): Promise<ComponentID[]>;
289
293
  /**
290
294
  * useful for workspace commands, such as `bit build`, `bit compile`.
291
295
  * by default, it should be running on new and modified components.
@@ -293,6 +297,7 @@ export declare class Workspace implements ComponentFactory {
293
297
  * some commands such as build/test needs to run also on the dependents.
294
298
  */
295
299
  getComponentsByUserInput(all?: boolean, pattern?: string, includeDependents?: boolean): Promise<Component[]>;
300
+ getComponentsUsingEnv(env: string, throwIfNotFound?: boolean): Promise<Component[]>;
296
301
  getMany(ids: Array<ComponentID>, forCapsule?: boolean): Promise<Component[]>;
297
302
  getManyByLegacy(components: ConsumerComponent[]): Promise<Component[]>;
298
303
  /**
@@ -379,6 +384,9 @@ export declare class Workspace implements ComponentFactory {
379
384
  }>;
380
385
  private filterEnvsFromExtensionsIfNeeded;
381
386
  triggerOnPreWatch(componentIds: ComponentID[], watchOpts: WatchOptions): Promise<void>;
387
+ addSpecificComponentConfig(id: ComponentID, aspectId: string, config?: Record<string, any>): Promise<void>;
388
+ removeSpecificComponentConfig(id: ComponentID, aspectId: string, markWithMinusIfNotExist: boolean): Promise<void>;
389
+ getSpecificComponentConfig(id: ComponentID, aspectId: string): Promise<any>;
382
390
  /**
383
391
  * This will mutate the entries with extensionId prop to have resolved legacy id
384
392
  * This should be worked on the extension data list not the new aspect list
@@ -397,7 +405,7 @@ export declare class Workspace implements ComponentFactory {
397
405
  * load aspects from the workspace and if not exists in the workspace, load from the scope.
398
406
  * keep in mind that the graph may have circles.
399
407
  */
400
- loadAspects(ids?: string[], throwOnError?: boolean): Promise<string[]>;
408
+ loadAspects(ids?: string[], throwOnError?: boolean, neededFor?: ComponentID): Promise<string[]>;
401
409
  /**
402
410
  * Note - this gets called from Harmony only.
403
411
  * returns one graph that includes all dependencies types. each edge has a label of the dependency
@@ -411,7 +419,7 @@ export declare class Workspace implements ComponentFactory {
411
419
  * Load all unloaded extensions from a list
412
420
  * @param extensions list of extensions with config to load
413
421
  */
414
- loadExtensions(extensions: ExtensionDataList, throwOnError?: boolean): Promise<void>;
422
+ loadExtensions(extensions: ExtensionDataList, originatedFrom?: ComponentID, throwOnError?: boolean): Promise<void>;
415
423
  /**
416
424
  * Provides a cache folder, unique per key.
417
425
  * Return value may be undefined, if workspace folder is unconventional (bare-scope, no node_modules, etc)
package/dist/workspace.js CHANGED
@@ -853,12 +853,14 @@ class Workspace {
853
853
  }
854
854
 
855
855
  async createAspectList(extensionDataList) {
856
- const entiresP = extensionDataList.map(async entry => {
857
- return new (_component().AspectEntry)(await this.resolveComponentId(entry.id), entry);
858
- });
856
+ const entiresP = extensionDataList.map(entry => this.extensionDataEntryToAspectEntry(entry));
859
857
  const entries = await Promise.all(entiresP);
860
858
  return this.componentAspect.createAspectListFromEntries(entries);
861
859
  }
860
+
861
+ async extensionDataEntryToAspectEntry(dataEntry) {
862
+ return new (_component().AspectEntry)(await this.resolveComponentId(dataEntry.id), dataEntry);
863
+ }
862
864
  /**
863
865
  * get a component from workspace
864
866
  * @param id component ID
@@ -880,7 +882,7 @@ class Workspace {
880
882
  try {
881
883
  this.componentLoadedSelfAsAspects.set(component.id.toString(), true);
882
884
  this.logger.debug(`trying to load self as aspect with id ${component.id.toString()}`);
883
- await this.loadAspects([component.id.toString()]); // In most cases if the load self as aspect failed we don't care about it.
885
+ await this.loadAspects([component.id.toString()], undefined, component.id); // In most cases if the load self as aspect failed we don't care about it.
884
886
  // we only need it in specific cases to work, but this workspace.get runs on different
885
887
  // cases where it might fail (like when importing aspect, after the import objects
886
888
  // when we write the package.json we run the applyTransformers which get to pkg which call
@@ -1068,14 +1070,18 @@ class Workspace {
1068
1070
  const componentDir = this.componentDir(id, {
1069
1071
  ignoreVersion: true
1070
1072
  });
1071
- const componentConfigFile = new (_componentConfigFile().ComponentConfigFile)(componentId, aspects, options.propagate);
1072
- await componentConfigFile.write(componentDir, {
1073
+ const componentConfigFile = new (_componentConfigFile().ComponentConfigFile)(componentId, aspects, componentDir, options.propagate);
1074
+ await componentConfigFile.write({
1073
1075
  override: options.override
1074
1076
  });
1075
1077
  return {
1076
1078
  configPath: _componentConfigFile().ComponentConfigFile.composePath(componentDir)
1077
1079
  };
1078
1080
  }
1081
+ /**
1082
+ * see component-aspect, createAspectListFromLegacy() method for a context why this is needed.
1083
+ */
1084
+
1079
1085
 
1080
1086
  async resolveScopeAspectListIds(aspectListFromScope) {
1081
1087
  const resolvedList = await aspectListFromScope.pmap(async entry => {
@@ -1112,11 +1118,13 @@ class Workspace {
1112
1118
  */
1113
1119
 
1114
1120
 
1115
- async idsByPattern(pattern) {
1121
+ async idsByPattern(pattern, throwForNoMatch = true) {
1116
1122
  if (!pattern.includes('*') && !pattern.includes(',')) {
1117
1123
  // if it's not a pattern but just id, resolve it without multimatch to support specifying id without scope-name
1118
1124
  const id = await this.resolveComponentId(pattern);
1119
- return [id];
1125
+ if (this.exists(id)) return [id];
1126
+ if (throwForNoMatch) throw new (_bitError().BitError)(`unable to find "${pattern}" in the workspace`);
1127
+ return [];
1120
1128
  }
1121
1129
 
1122
1130
  const ids = await this.listIds();
@@ -1124,7 +1132,13 @@ class Workspace {
1124
1132
 
1125
1133
  const idsToCheck = id => [id.toStringWithoutVersion(), id._legacy.toStringWithoutVersion()];
1126
1134
 
1127
- return ids.filter(id => (0, _multimatch().default)(idsToCheck(id), patterns).length);
1135
+ const idsFiltered = ids.filter(id => (0, _multimatch().default)(idsToCheck(id), patterns).length);
1136
+
1137
+ if (throwForNoMatch && !idsFiltered.length) {
1138
+ throw new (_bitError().BitError)(`unable to find any matching for "${pattern}" pattern`);
1139
+ }
1140
+
1141
+ return idsFiltered;
1128
1142
  }
1129
1143
  /**
1130
1144
  * useful for workspace commands, such as `bit build`, `bit compile`.
@@ -1156,6 +1170,20 @@ class Workspace {
1156
1170
  return newAndModified;
1157
1171
  }
1158
1172
 
1173
+ async getComponentsUsingEnv(env, throwIfNotFound = false) {
1174
+ const allComps = await this.list();
1175
+ const allEnvs = await this.envs.createEnvironment(allComps);
1176
+ const foundEnv = allEnvs.runtimeEnvs.find(runtimeEnv => runtimeEnv.id === env);
1177
+
1178
+ if (!foundEnv && throwIfNotFound) {
1179
+ const availableEnvs = allEnvs.runtimeEnvs.map(runtimeEnv => runtimeEnv.id);
1180
+ throw new (_bitError().BitError)(`unable to find components that using "${env}" env.
1181
+ the following envs are used in this workspace: ${availableEnvs.join(', ')}`);
1182
+ }
1183
+
1184
+ return (foundEnv === null || foundEnv === void 0 ? void 0 : foundEnv.components) || [];
1185
+ }
1186
+
1159
1187
  async getMany(ids, forCapsule = false) {
1160
1188
  return this.componentLoader.getMany(ids, forCapsule);
1161
1189
  }
@@ -1447,7 +1475,7 @@ class Workspace {
1447
1475
  const extsWithoutRemoved = extensions.filterRemovedExtensions();
1448
1476
  const selfInMergedExtensions = extsWithoutRemoved.findExtension(componentId._legacy.toStringWithoutScopeAndVersion(), true, true);
1449
1477
  const extsWithoutSelf = selfInMergedExtensions !== null && selfInMergedExtensions !== void 0 && selfInMergedExtensions.extensionId ? extsWithoutRemoved.remove(selfInMergedExtensions.extensionId) : extsWithoutRemoved;
1450
- await this.loadExtensions(extsWithoutSelf);
1478
+ await this.loadExtensions(extsWithoutSelf, componentId);
1451
1479
  const {
1452
1480
  extensionDataListFiltered,
1453
1481
  envIsCurrentlySet
@@ -1557,6 +1585,46 @@ class Workspace {
1557
1585
  await func(components, watchOpts);
1558
1586
  });
1559
1587
  }
1588
+
1589
+ async addSpecificComponentConfig(id, aspectId, config = {}) {
1590
+ const componentConfigFile = await this.componentConfigFile(id);
1591
+
1592
+ if (componentConfigFile) {
1593
+ await componentConfigFile.addAspect(aspectId, config, this.resolveComponentId.bind(this));
1594
+ await componentConfigFile.write({
1595
+ override: true
1596
+ });
1597
+ } else {
1598
+ this.bitMap.addComponentConfig(id, aspectId, config);
1599
+ }
1600
+ }
1601
+
1602
+ async removeSpecificComponentConfig(id, aspectId, markWithMinusIfNotExist) {
1603
+ const componentConfigFile = await this.componentConfigFile(id);
1604
+
1605
+ if (componentConfigFile) {
1606
+ await componentConfigFile.removeAspect(aspectId, markWithMinusIfNotExist, this.resolveComponentId.bind(this));
1607
+ await componentConfigFile.write({
1608
+ override: true
1609
+ });
1610
+ } else {
1611
+ this.bitMap.removeComponentConfig(id, aspectId, markWithMinusIfNotExist);
1612
+ }
1613
+ }
1614
+
1615
+ async getSpecificComponentConfig(id, aspectId) {
1616
+ var _this$bitMap$getBitma;
1617
+
1618
+ const componentConfigFile = await this.componentConfigFile(id);
1619
+
1620
+ if (componentConfigFile) {
1621
+ var _componentConfigFile$2;
1622
+
1623
+ return (_componentConfigFile$2 = componentConfigFile.aspects.get(aspectId)) === null || _componentConfigFile$2 === void 0 ? void 0 : _componentConfigFile$2.config;
1624
+ }
1625
+
1626
+ return (_this$bitMap$getBitma = this.bitMap.getBitmapEntry(id).config) === null || _this$bitMap$getBitma === void 0 ? void 0 : _this$bitMap$getBitma[aspectId];
1627
+ }
1560
1628
  /**
1561
1629
  * This will mutate the entries with extensionId prop to have resolved legacy id
1562
1630
  * This should be worked on the extension data list not the new aspect list
@@ -1648,8 +1716,10 @@ class Workspace {
1648
1716
  */
1649
1717
 
1650
1718
 
1651
- async loadAspects(ids = [], throwOnError = false) {
1652
- this.logger.debug(`loading ${ids.length} aspects`);
1719
+ async loadAspects(ids = [], throwOnError = false, neededFor) {
1720
+ this.logger.info(`loadAspects, loading ${ids.length} aspects.
1721
+ ids: ${ids.join(', ')}
1722
+ needed-for: ${(neededFor === null || neededFor === void 0 ? void 0 : neededFor.toString()) || '<unknown>'}`);
1653
1723
  const notLoadedIds = ids.filter(id => !this.aspectLoader.isAspectLoaded(id));
1654
1724
  if (!notLoadedIds.length) return [];
1655
1725
  const coreAspectsStringIds = this.aspectLoader.getCoreAspectIds();
@@ -1809,7 +1879,7 @@ class Workspace {
1809
1879
  */
1810
1880
 
1811
1881
 
1812
- async loadExtensions(extensions, throwOnError = false) {
1882
+ async loadExtensions(extensions, originatedFrom, throwOnError = false) {
1813
1883
  const extensionsIdsP = extensions.map(async extensionEntry => {
1814
1884
  // Core extension
1815
1885
  if (!extensionEntry.extensionId) {
@@ -1824,7 +1894,7 @@ class Workspace {
1824
1894
  const loadedExtensions = this.harmony.extensionsIds;
1825
1895
  const extensionsToLoad = (0, _lodash().difference)(extensionsIds, loadedExtensions);
1826
1896
  if (!extensionsToLoad.length) return;
1827
- await this.loadAspects(extensionsToLoad, throwOnError);
1897
+ await this.loadAspects(extensionsToLoad, throwOnError, originatedFrom);
1828
1898
  }
1829
1899
  /**
1830
1900
  * Provides a cache folder, unique per key.
@@ -2069,10 +2139,7 @@ class Workspace {
2069
2139
 
2070
2140
  async _saveManyComponentConfigFiles(componentConfigFiles) {
2071
2141
  await Promise.all(Array.from(componentConfigFiles).map(async componentConfigFile => {
2072
- const componentDir = this.componentDir(componentConfigFile.componentId, {
2073
- ignoreVersion: true
2074
- });
2075
- await componentConfigFile.write(componentDir, {
2142
+ await componentConfigFile.write({
2076
2143
  override: true
2077
2144
  });
2078
2145
  }));
@@ -2462,12 +2529,12 @@ your workspace.jsonc has this component-id set. you might want to remove/change
2462
2529
  const existsOnWorkspace = await this.hasId(envId);
2463
2530
  const envIdStrNoVersion = envId.toStringWithoutVersion();
2464
2531
  await this.unsetEnvFromComponents(componentIds);
2465
- componentIds.forEach(componentId => {
2466
- this.bitMap.addComponentConfig(componentId, existsOnWorkspace ? envIdStrNoVersion : envIdStr);
2467
- this.bitMap.addComponentConfig(componentId, _envs().EnvsAspect.id, {
2532
+ await Promise.all(componentIds.map(async componentId => {
2533
+ await this.addSpecificComponentConfig(componentId, existsOnWorkspace ? envIdStrNoVersion : envIdStr);
2534
+ await this.addSpecificComponentConfig(componentId, _envs().EnvsAspect.id, {
2468
2535
  env: envIdStrNoVersion
2469
2536
  });
2470
- });
2537
+ }));
2471
2538
  await this.bitMap.write();
2472
2539
  }
2473
2540
  /**
@@ -2478,11 +2545,8 @@ your workspace.jsonc has this component-id set. you might want to remove/change
2478
2545
  async unsetEnvFromComponents(ids) {
2479
2546
  const changed = [];
2480
2547
  const unchanged = [];
2481
- ids.forEach(id => {
2482
- var _bitMapEntry$config;
2483
-
2484
- const bitMapEntry = this.bitMap.getBitmapEntry(id);
2485
- const envsAspect = (_bitMapEntry$config = bitMapEntry.config) === null || _bitMapEntry$config === void 0 ? void 0 : _bitMapEntry$config[_envs().EnvsAspect.id];
2548
+ await Promise.all(ids.map(async id => {
2549
+ const envsAspect = await this.getSpecificComponentConfig(id, _envs().EnvsAspect.id);
2486
2550
  const currentEnv = envsAspect && envsAspect !== _config().REMOVE_EXTENSION_SPECIAL_SIGN ? envsAspect.env : null;
2487
2551
 
2488
2552
  if (!currentEnv) {
@@ -2490,10 +2554,10 @@ your workspace.jsonc has this component-id set. you might want to remove/change
2490
2554
  return;
2491
2555
  }
2492
2556
 
2493
- this.bitMap.removeComponentConfig(id, currentEnv, false);
2494
- this.bitMap.removeComponentConfig(id, _envs().EnvsAspect.id, false);
2557
+ await this.removeSpecificComponentConfig(id, currentEnv, false);
2558
+ await this.removeSpecificComponentConfig(id, _envs().EnvsAspect.id, false);
2495
2559
  changed.push(id);
2496
- });
2560
+ }));
2497
2561
  await this.bitMap.write();
2498
2562
  return {
2499
2563
  changed,