Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix(core): fixed SettingsType.ANY field not parsing correctly
  • Loading branch information
jj811208 committed Nov 23, 2022
commit 55bb4e14317da85baf4c1eed80b00e23bb9cd78c
34 changes: 34 additions & 0 deletions .yarn/versions/72503862.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
releases:
"@yarnpkg/core": minor

declined:
- "@yarnpkg/plugin-compat"
- "@yarnpkg/plugin-constraints"
- "@yarnpkg/plugin-dlx"
- "@yarnpkg/plugin-essentials"
- "@yarnpkg/plugin-exec"
- "@yarnpkg/plugin-file"
- "@yarnpkg/plugin-git"
- "@yarnpkg/plugin-github"
- "@yarnpkg/plugin-http"
- "@yarnpkg/plugin-init"
- "@yarnpkg/plugin-interactive-tools"
- "@yarnpkg/plugin-link"
- "@yarnpkg/plugin-nm"
- "@yarnpkg/plugin-npm"
- "@yarnpkg/plugin-npm-cli"
- "@yarnpkg/plugin-pack"
- "@yarnpkg/plugin-patch"
- "@yarnpkg/plugin-pnp"
- "@yarnpkg/plugin-pnpm"
- "@yarnpkg/plugin-stage"
- "@yarnpkg/plugin-typescript"
- "@yarnpkg/plugin-version"
- "@yarnpkg/plugin-workspace-tools"
- "@yarnpkg/builder"
- "@yarnpkg/cli"
- "@yarnpkg/doctor"
- "@yarnpkg/extensions"
- "@yarnpkg/nm"
- "@yarnpkg/pnpify"
- "@yarnpkg/sdks"
2 changes: 1 addition & 1 deletion packages/yarnpkg-core/sources/Configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ function parseSingleValue(configuration: Configuration, path: string, valueBase:

switch (definition.type) {
case SettingsType.ANY:
return value;
return configUtils.getValueByTree(value);
case SettingsType.SHAPE:
return parseShape(configuration, path, valueBase, definition, folder);
case SettingsType.MAP:
Expand Down
16 changes: 16 additions & 0 deletions packages/yarnpkg-core/sources/configUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,22 @@ export function getValue(value: unknown) {
return isResolvedRcFile(value) ? value[1] : value;
}

export function getValueByTree(valueBase: unknown): unknown {
const value = isResolvedRcFile(valueBase) ? valueBase[1] : valueBase;

if (Array.isArray(value))
return value.map(v => getValueByTree(v));

if (isObject(value)) {
const result: {[key: string]: unknown} = {};
for (const [propKey, propValue] of Object.entries(value))
result[propKey] = getValueByTree(propValue);
return result;
}

return value;
}

export function getSource(value: unknown) {
return isResolvedRcFile(value) ? value[0] : null;
}