-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: chunk-optmization, script to swipe out remote-script
- Loading branch information
1 parent
b42dc19
commit e67eaaf
Showing
8 changed files
with
222 additions
and
168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,30 @@ | ||
{ | ||
"name": "@walless/landing", | ||
"version": "0.0.1", | ||
"private": true, | ||
"scripts": { | ||
"dev": "next dev -p 3005", | ||
"build": "next build", | ||
"start": "next start", | ||
"lint": "next lint", | ||
"lint:fix": "next lint --fix" | ||
}, | ||
"dependencies": { | ||
"@tamagui/animations-css": "1.15.16", | ||
"@tamagui/next-theme": "1.15.16", | ||
"@walless/gui": "*", | ||
"@walless/markdown": "*", | ||
"@walless/ui": "*", | ||
"firebase": "10.5.0", | ||
"html-to-image": "^1.11.11", | ||
"next": "13.4.9", | ||
"react-dom": "^18.2.0", | ||
"valtio": "1.10.5" | ||
}, | ||
"devDependencies": { | ||
"@tamagui/next-plugin": "1.15.16", | ||
"eslint": "8.38.0", | ||
"next-compose-plugins": "^2.2.1", | ||
"next-transpile-modules": "10.0.0" | ||
} | ||
"name": "@walless/landing", | ||
"version": "0.0.1", | ||
"private": true, | ||
"scripts": { | ||
"dev": "next dev -p 3005", | ||
"build": "next build", | ||
"start": "next start", | ||
"lint": "next lint", | ||
"lint:fix": "next lint --fix" | ||
}, | ||
"dependencies": { | ||
"@tamagui/animations-css": "1.15.16", | ||
"@tamagui/next-theme": "1.15.16", | ||
"@walless/gui": "*", | ||
"@walless/markdown": "*", | ||
"@walless/ui": "*", | ||
"firebase": "10.7.0", | ||
"html-to-image": "^1.11.11", | ||
"next": "13.4.9", | ||
"react-dom": "^18.2.0", | ||
"valtio": "1.10.5" | ||
}, | ||
"devDependencies": { | ||
"@tamagui/next-plugin": "1.15.16", | ||
"eslint": "8.38.0", | ||
"next-compose-plugins": "^2.2.1", | ||
"next-transpile-modules": "10.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,3 @@ | ||
const keepBackgroundAlive = () => { | ||
const runtime = global.chrome?.runtime; | ||
if (runtime) { | ||
if (runtime?.id) { | ||
// Keep Manifest V3 service worker alive | ||
chrome.runtime.onInstalled.addListener(() => { | ||
chrome.alarms.get('keep-alive', (a) => { | ||
if (!a) { | ||
chrome.alarms.create('keep-alive', { periodInMinutes: 0.1 }); | ||
} | ||
}); | ||
}); | ||
} | ||
|
||
// Add a noop listener to the alarm. Without this, the service worker seems | ||
// to be deemed as idle by Chrome and will be killed after 30s. | ||
chrome.alarms.onAlarm.addListener(() => { | ||
Function.prototype(); | ||
}); | ||
} | ||
}; | ||
|
||
keepBackgroundAlive(); | ||
importScripts('kernel.js'); | ||
|
||
export default {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
import { runtime } from '@walless/core'; | ||
|
||
import { keepBackgroundAlive } from './utils/extension'; | ||
import { injectModules } from './utils/ioc'; | ||
import { initializeMessaging } from './messaging'; | ||
import { configurePWA } from './pwa'; | ||
|
||
console.log(new Date().toISOString(), 'initializing kernel..'); | ||
console.log(new Date().toISOString(), 'Initializing kernel..'); | ||
|
||
injectModules().then(async () => { | ||
await Promise.all([initializeMessaging()]); | ||
}); | ||
|
||
if (!runtime.isExtension) { | ||
if (runtime.isExtension) { | ||
keepBackgroundAlive(); | ||
} else { | ||
configurePWA(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const runtime = global.chrome?.runtime; | ||
|
||
export const keepBackgroundAlive = () => { | ||
if (runtime) { | ||
if (runtime?.id) { | ||
// Keep Manifest V3 service worker alive | ||
chrome.runtime.onInstalled.addListener(() => { | ||
chrome.alarms.get('keep-alive', (a) => { | ||
if (!a) { | ||
chrome.alarms.create('keep-alive', { periodInMinutes: 0.1 }); | ||
} | ||
}); | ||
}); | ||
} | ||
|
||
// Add a noop listener to the alarm. Without this, the service worker seems | ||
// to be deemed as idle by Chrome and will be killed after 30s. | ||
chrome.alarms.onAlarm.addListener(() => { | ||
Function.prototype(); | ||
}); | ||
} | ||
}; |
Oops, something went wrong.