Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add config to disable sourceList (#572)
- Loading branch information
Showing
10 changed files
with
104 additions
and
21 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
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
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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { mockStaticServer } from '@garfish/test-suite'; | ||
import Garfish from '../src/index'; | ||
|
||
describe('Core: preload plugin', () => { | ||
const vueSubAppEntry = './resources/vueApp.html'; | ||
const reactSubAppEntry = './resources/reactApp.html'; | ||
|
||
mockStaticServer({ | ||
baseDir: __dirname, | ||
}); | ||
|
||
it('disablePreloadApp is false use setRanking', async () => { | ||
const GarfishInstance = new Garfish({}); | ||
GarfishInstance.run({ | ||
disablePreloadApp: false, | ||
apps: [ | ||
{ | ||
name: 'vue-app', | ||
entry: vueSubAppEntry, | ||
}, | ||
{ | ||
name: 'react-app', | ||
entry: reactSubAppEntry, | ||
}, | ||
], | ||
}); | ||
let app = await GarfishInstance.loadApp('vue-app'); | ||
await app?.mount(); | ||
app?.addSourceList({tagName: 'fetch', url: "http://localhost/resources/scripts/fetch.js"}); | ||
app?.addSourceList({tagName: 'fetch', url: "http://localhost/resources/scripts/no-entry.js"}); | ||
app?.addSourceList({tagName: 'style', url: "http://localhost/resources/scripts/style.js"}); | ||
app?.addSourceList([ | ||
{tagName: 'fetch', url: "http://localhost/resources/scripts/fetch.js"}, | ||
{tagName: 'script', url: "http://localhost/resources/index.js"}, | ||
]); | ||
|
||
expect(app!.sourceList.length).toBe(4); | ||
expect(app!.sourceList[0]).toMatchObject({ | ||
tagName: 'script', | ||
url: 'http://localhost/resources/scripts/no-entry.js' | ||
}); | ||
expect(app!.sourceList[1]).toMatchObject({ | ||
tagName: 'fetch', | ||
url: 'http://localhost/resources/scripts/fetch.js' | ||
}); | ||
expect(app!.sourceList[2]).toMatchObject({ | ||
tagName: 'style', | ||
url: 'http://localhost/resources/scripts/style.js' | ||
}); | ||
expect(app!.sourceList[3]).toMatchObject({ | ||
tagName: 'script', | ||
url: 'http://localhost/resources/index.js' | ||
}); | ||
}); | ||
}); |
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
1cfd9a0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
garfish – ./
garfish.vercel.app
garfishjs.org
garfish-git-main-garfish.vercel.app
www.garfishjs.org
garfish-garfish.vercel.app