Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps-dev: Update to TypeScript 5 #165

Merged
merged 1 commit into from
Mar 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
128 changes: 75 additions & 53 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@
"@types/lodash": "^4.14.191",
"@types/node": "^18.15.3",
"@types/nunjucks": "^3.2.2",
"@typescript-eslint/eslint-plugin": "^5.54.1",
"@typescript-eslint/parser": "^5.54.1",
"@typescript-eslint/eslint-plugin": "^5.55.0",
"@typescript-eslint/parser": "^5.55.0",
"autoprefixer": "^10.4.13",
"babel-loader": "^9.1.2",
"dprint": "^0.34.5",
Expand Down Expand Up @@ -93,7 +93,7 @@
"stylelint": "^15.2.0",
"stylelint-config-standard-scss": "^7.0.1",
"ts-node": "^10.9.1",
"typescript": "^4.9.5",
"typescript": "^5.0.2",
"vitest": "^0.29.2",
"webpack": "^5.76.2",
"webpack-cli": "^5.0.1"
Expand Down
14 changes: 6 additions & 8 deletions src/lib/getMacroOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,14 @@ export async function addInternalComponents(transformedOptions: TransformedOptio
(param) => param.name,
)

const uniqueComponentsToEmbed = new Set(componentsToEmbed)
const updatedOptions = transformedOptions

// eslint-disable-next-line no-restricted-syntax
for (const componentName of uniqueComponentsToEmbed) {
// eslint-disable-next-line no-await-in-loop
const uniqueComponentsToEmbed = [...new Set(componentsToEmbed)]
const embeddedOptionsPromises = uniqueComponentsToEmbed.map(async (componentName) => {
const rawOptions = await getRawMacroOptions(componentName)
// Further unnesting is not handled for these, as there are no current cases of this
updatedOptions.nested.push({ name: componentName, path: componentName, params: rawOptions })
}
return { name: componentName, path: componentName, params: rawOptions }
})
updatedOptions.nested.push(...await Promise.all(embeddedOptionsPromises))

return updatedOptions
}

Expand Down
12 changes: 3 additions & 9 deletions src/site/_data/macroOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,8 @@ const { getAllComponentNames, getMacroOptions } = require('../../lib')

module.exports = async function getAllMacroOptions() {
const componentNames = getAllComponentNames()
const componentOptions = []
// Note that parallelising these causes all components to have the same macro options
// Probably caused by https://github.com/microsoft/TypeScript/issues/51554
// (fixed in TypeScript 5)
// eslint-disable-next-line no-restricted-syntax
for (const componentName of componentNames) {
// eslint-disable-next-line no-await-in-loop
componentOptions.push([componentName, await getMacroOptions(componentName)])
}
const componentOptions = await Promise.all(
componentNames.map(async (componentName) => [componentName, await getMacroOptions(componentName)]),
)
return Object.fromEntries(componentOptions)
}