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

Make Module Documentation Available #1281

Merged
merged 26 commits into from
Sep 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
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
5 changes: 1 addition & 4 deletions src/modules/moduleLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,7 @@ const memoizedGetModuleFileInternal = memoize(getModuleFile)
export const memoizedGetModuleFile = (name: string, type: 'tab' | 'bundle' | 'json') =>
memoizedGetModuleFileInternal({ name, type })
function getModuleFile({ name, type }: { name: string; type: 'tab' | 'bundle' | 'json' }): string {
if (type === 'json') {
return httpGet(`${MODULES_STATIC_URL}/jsons/${name}.json`)
}
return httpGet(`${MODULES_STATIC_URL}/${type}s/${name}.js`)
return httpGet(`${MODULES_STATIC_URL}/${type}s/${name}.js${type === 'json' ? 'on' : ''}`)
}

/**
Expand Down
6 changes: 1 addition & 5 deletions src/name-extractor/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,11 +321,7 @@ function getNames(node: es.Node, locTest: (node: es.Node) => boolean): NameDecla
}

return specs.map(spec => {
if (spec.type !== 'ImportSpecifier') {
throw new Error(`Expected ImportSpecifier, got ${spec.type}`)
}

if (docs[spec.local.name] === undefined) {
if (spec.type !== 'ImportSpecifier' || docs[spec.local.name] === undefined) {
return {
name: spec.local.name,
meta: KIND_IMPORT,
Expand Down