Parcel upgrade and global dependency update
This commit is contained in:
+17
-13
@@ -60,7 +60,7 @@ import { FilterList } from "./components/filter";
|
||||
import { FilterOption, PageMeta } from "@silverbulletmd/common/types";
|
||||
import { syntaxTree } from "@codemirror/language";
|
||||
import sandboxSyscalls from "@plugos/plugos/syscalls/sandbox";
|
||||
import globalModules from "../common/dist/global.plug.json";
|
||||
// import globalModules from "../common/dist/global.plug.json";
|
||||
|
||||
class PageState {
|
||||
constructor(
|
||||
@@ -134,18 +134,6 @@ export class Editor {
|
||||
sandboxSyscalls(this.system)
|
||||
);
|
||||
|
||||
this.system.on({
|
||||
plugLoaded: (plug) => {
|
||||
safeRun(async () => {
|
||||
for (let [modName, code] of Object.entries(
|
||||
globalModules.dependencies
|
||||
)) {
|
||||
await plug.sandbox.loadDependency(modName, code);
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
// Make keyboard shortcuts work even when the editor is in read only mode or not focused
|
||||
window.addEventListener("keydown", (ev) => {
|
||||
if (!this.editorView?.hasFocus) {
|
||||
@@ -179,6 +167,22 @@ export class Editor {
|
||||
}
|
||||
});
|
||||
|
||||
let globalModules: any = await (await fetch("/global.plug.json")).json();
|
||||
|
||||
console.log("Global modules", globalModules);
|
||||
|
||||
this.system.on({
|
||||
plugLoaded: (plug) => {
|
||||
safeRun(async () => {
|
||||
for (let [modName, code] of Object.entries(
|
||||
globalModules.dependencies
|
||||
)) {
|
||||
await plug.sandbox.loadDependency(modName, code as string);
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
this.space.on({
|
||||
pageChanged: (meta) => {
|
||||
if (this.currentPage === meta.name) {
|
||||
|
||||
@@ -55,19 +55,19 @@
|
||||
"react-dom": "^17.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@parcel/packager-raw-url": "2.3.2",
|
||||
"@parcel/service-worker": "2.3.2",
|
||||
"@parcel/transformer-inline-string": "2.3.2",
|
||||
"@parcel/transformer-sass": "2.3.2",
|
||||
"@parcel/transformer-webmanifest": "2.3.2",
|
||||
"@parcel/validator-typescript": "2.3.2",
|
||||
"@parcel/packager-raw-url": "2.6.0",
|
||||
"@parcel/service-worker": "2.6.0",
|
||||
"@parcel/transformer-inline-string": "2.6.0",
|
||||
"@parcel/transformer-sass": "2.6.0",
|
||||
"@parcel/transformer-webmanifest": "2.6.0",
|
||||
"@parcel/validator-typescript": "2.6.0",
|
||||
"@types/cors": "^2.8.12",
|
||||
"@types/events": "^3.0.0",
|
||||
"@types/jest": "^27.4.1",
|
||||
"@types/react": "^17.0.39",
|
||||
"@types/react-dom": "^17.0.11",
|
||||
"assert": "^2.0.0",
|
||||
"parcel": "2.3.2",
|
||||
"parcel": "2.6.0",
|
||||
"prettier": "^2.5.1",
|
||||
"typescript": "^4.6.2"
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import { manifest, version } from "@parcel/service-worker";
|
||||
async function install() {
|
||||
const cache = await caches.open(version);
|
||||
// console.log("Installing", manifest, "version", version);
|
||||
await cache.addAll(manifest);
|
||||
await cache.addAll([...manifest, "/global.plug.json"]);
|
||||
// @ts-ignore
|
||||
self.skipWaiting(); // This automatically enables the service worker, preventing from caching stuff forever if there's a page open
|
||||
// console.log("Installed");
|
||||
|
||||
Reference in New Issue
Block a user