mirror of
https://github.com/jackyzha0/quartz
synced 2026-11-27 22:14:40 +01:00
test: npm plugins are found through import.meta.resolve; changeset for the Windows plugin index fix
This commit is contained in:
2 files changed
+19
No files matched your search
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@jackyzha0/quartz": patch
|
||||
---
|
||||
|
||||
On Windows, regenerating `.quartz/plugins/index.ts` (`npm run install-plugins`, which also runs before every `npm run build`) no longer skips npm plugins with "dist/index.d.ts could not be found", which left exports such as `ExternalPlugin.Explorer` undefined. The package's location was read from a `file:` URL's pathname (`/C:/…`), which is not a Windows path.
|
||||
@@ -46,6 +46,20 @@ function fakeSite() {
|
||||
}
|
||||
|
||||
describe("plugin index", () => {
|
||||
// npm plugins are found through import.meta.resolve, which returns a file: URL. Its pathname
|
||||
// is not a path on Windows (`/C:/…`), so every npm plugin was skipped there (#2616).
|
||||
test("npm plugins are found through their package.json", () => {
|
||||
const pluginsDir = fs.mkdtempSync(path.join(os.tmpdir(), "quartz-plugin-index-npm-"))
|
||||
const entry = collectPluginExports({
|
||||
pluginsDir,
|
||||
npmPackages: ["@quartz-community/explorer"],
|
||||
}).get("quartz-community__explorer")
|
||||
assert.ok(entry, "@quartz-community/explorer was skipped")
|
||||
assert.ok(entry.overridable.includes("Explorer"))
|
||||
assert.strictEqual(entry.importPath, "@quartz-community/explorer")
|
||||
fs.rmSync(pluginsDir, { recursive: true, force: true })
|
||||
})
|
||||
|
||||
test("component constructors re-exported from a sub-module are wrapped (#2565)", () => {
|
||||
const { root, pluginsDir } = fakeSite()
|
||||
const entry = collectPluginExports({ pluginsDir }).get("my-widget")!
|
||||
|
||||
Reference in new issue
Block a user