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

refactor: rework dynamic imports #59

Merged
merged 14 commits into from
Dec 18, 2024
Prev Previous commit
Next Next commit
continue
lowlighter committed Dec 18, 2024

Verified

This commit was signed with the committer’s verified signature.
lowlighter Simon Lecoq
commit f1b44983e9f4605ac570886e1d8cd934d49f7938
10 changes: 9 additions & 1 deletion .github/tools/vendor_imports.ts
Original file line number Diff line number Diff line change
@@ -33,7 +33,15 @@ export class Vendor {

/** Vendor files from github repository. */
async github(
{ repository, branch, path, globs, destination = "", export: exporter, callback }: { repository: string; branch: string; path: string; globs?: string[]; destination?: string; export?: (name: string) => string; callback?: (name: string, _: { log: Logger }) => Promisable<void> },
{ repository, branch, path, globs, destination = "", export: exporter, callback }: {
repository: string
branch: string
path: string
globs?: string[]
destination?: string
export?: (name: string) => string
callback?: (name: string, _: { log: Logger }) => Promisable<void>
},
) {
// Clean directory
if (exporter) {
4 changes: 2 additions & 2 deletions @mizu/code/mod.ts
Original file line number Diff line number Diff line change
@@ -24,9 +24,9 @@ export const _code = {
// Load language syntax
const parsed = renderer.parseAttribute(attribute, this.typings, { modifiers: true })
const language = (mapping as Record<PropertyKey, string>)[parsed.tag] ?? "plaintext"
const { hljs } = await import("./import/highlight.js/core.ts")
const { default: hljs } = await import("highlight.js/lib/core")
if (!hljs.getLanguage(language)) {
const { syntax } = await import(`./import/highlight.js/languages/${language}.ts`)
const { default: syntax } = await import(`highlight.js/lib/languages/${language}`)
hljs.registerLanguage(language, syntax)
}