@lincyaw/compiler 1.0.0-rc.23 → 1.0.0-rc.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/plugins.ts +6 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lincyaw/compiler",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.24",
|
|
4
4
|
"description": "Presmium's compiler: structured JSON documents to runtime IR, plugin loading, compile-time execution and its cache, checks and the renderers",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"semver": "^7.8.5",
|
|
39
39
|
"send": "1.2.1",
|
|
40
40
|
"yaml": "^2.9.1",
|
|
41
|
-
"@lincyaw/kernel": "1.0.0-rc.
|
|
41
|
+
"@lincyaw/kernel": "1.0.0-rc.24"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/content-disposition": "^0.5.9",
|
package/src/plugins.ts
CHANGED
|
@@ -37,11 +37,13 @@ export async function loadPlugin(name: string, deckDir: string, sources?: Plugin
|
|
|
37
37
|
const problem = (severity: Severity, message: string): PluginProblem => ({ name, severity, message })
|
|
38
38
|
const own = findPackageDir(name, resolve(deckDir))
|
|
39
39
|
const bundled = bundledDir(name, sources)
|
|
40
|
-
// An official plugin is versioned with the Presmium that runs it (its host, viewer and kernel): the
|
|
41
|
-
// copy
|
|
42
|
-
|
|
40
|
+
// An official plugin is versioned with the Presmium that runs it (its host, viewer and kernel): use the
|
|
41
|
+
// installation's copy whenever the project has a separate copy, even when both happen to have the same version.
|
|
42
|
+
// Otherwise the plugin's browser bundle can carry a second host module and fail with "no host installed".
|
|
43
|
+
if (own && bundled && name.startsWith(PRESMIUM_SCOPE) && realpathSync(own) !== realpathSync(bundled)) {
|
|
43
44
|
const result = await loadFrom(name, bundled, problem)
|
|
44
|
-
|
|
45
|
+
if (result.problem || packageVersion(own) === packageVersion(bundled)) return result
|
|
46
|
+
return { ...result, problem: problem('warning', `plugin "${name}": the project's ${packageVersion(own)} is not used; this Presmium runs its own ${packageVersion(bundled)}. Update the project's @lincyaw packages (pnpm up "@lincyaw/*") or run the project's own presmium (pnpm exec presmium)`) }
|
|
45
47
|
}
|
|
46
48
|
const dir = own ?? bundled
|
|
47
49
|
if (!dir) return { problem: problem('error', `cannot load plugin "${name}": package not found from ${deckDir}`) }
|