-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement Site.Prototype methods in ES6 syntax #2280 #2356
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
ae2ae5f
Implement Site.Prototype methods in ES6 syntax
jmestxr 3636f5e
Remove commented out code
jmestxr 979afbf
Add explicit type casting to backgroundBuildNotViewedFiles
jmestxr 53b98a3
Amend calls to rebuildSourceFiles in serveUtil.js
jmestxr 4aec408
Merge branch 'master' into refactor-site-prototype
jmestxr b18857a
add newline
tlylt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -191,9 +191,6 @@ export class Site { | |
currentOpenedPages: string[]; | ||
toRebuild: Set<string>; | ||
externalManager!: ExternalManager; | ||
buildAsset?: (this: any, arg: unknown) => Bluebird<unknown>; | ||
rebuildAffectedSourceFiles?: (this: any, arg: unknown) => Bluebird<unknown>; | ||
rebuildSourceFiles?: (this: any, arg: unknown) => Bluebird<unknown>; | ||
// TODO: add LayoutManager when it has been migrated | ||
layoutManager: any; | ||
|
||
|
@@ -1678,58 +1675,35 @@ export class Site { | |
this.variableProcessor.addUserDefinedVariableForAllSites('timestamp', time); | ||
} | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-unused-vars, class-methods-use-this | ||
async rebuildPagesBeingViewed(_currentPageViewed: string) { | ||
throw new Error('Method not implemented.'); | ||
} | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-unused-vars, class-methods-use-this | ||
async removeAsset(_removedPageFilePaths: string | string[]) { | ||
throw new Error('Method not implemented.'); | ||
} | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-unused-vars, class-methods-use-this | ||
async backgroundBuildNotViewedFiles(_arg0?: any, _arg1?: any) { | ||
throw new Error('Method not implemented.'); | ||
} | ||
} | ||
|
||
/** | ||
* Below are functions that are not compatible with the ES6 class syntax. | ||
*/ | ||
|
||
/** | ||
* Build/copy assets that are specified in filePaths | ||
* @param filePaths a single path or an array of paths corresponding to the assets to build | ||
*/ | ||
Site.prototype.buildAsset = delay(Site.prototype._buildMultipleAssets as () => Bluebird<unknown>, 1000); | ||
/** | ||
* Build/copy assets that are specified in filePaths | ||
* @param filePaths a single path or an array of paths corresponding to the assets to build | ||
*/ | ||
buildAsset = delay(this._buildMultipleAssets as () => Bluebird<unknown>, 1000); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might cause a type problem in the future when serveUtil.js is migrated to TypeScript, but should be ok for now. |
||
|
||
Site.prototype.rebuildPagesBeingViewed = delay( | ||
Site.prototype._rebuildPagesBeingViewed as () => Bluebird<unknown>, 1000); | ||
/** | ||
* Remove assets that are specified in filePaths | ||
* @param filePaths a single path or an array of paths corresponding to the assets to remove | ||
*/ | ||
removeAsset = delay(this._removeMultipleAssets as () => Bluebird<unknown>, 1000); | ||
|
||
/** | ||
* Rebuild pages that are affected by changes in filePaths | ||
* @param filePaths a single path or an array of paths corresponding to the files that have changed | ||
*/ | ||
Site.prototype.rebuildAffectedSourceFiles = delay( | ||
Site.prototype._rebuildAffectedSourceFiles as () => Bluebird<unknown>, 1000); | ||
rebuildPagesBeingViewed = delay(this._rebuildPagesBeingViewed as () => Bluebird<unknown>, 1000); | ||
|
||
/** | ||
* Rebuild all pages | ||
* @param filePaths a single path or an array of paths corresponding to the files that have changed | ||
*/ | ||
Site.prototype.rebuildSourceFiles = delay( | ||
Site.prototype._rebuildSourceFiles as () => Bluebird<unknown>, 1000); | ||
/** | ||
* Rebuild pages that are affected by changes in filePaths | ||
* @param filePaths a single path or an array of paths corresponding to the files that have changed | ||
*/ | ||
rebuildAffectedSourceFiles = delay(this._rebuildAffectedSourceFiles as () => Bluebird<unknown>, 1000); | ||
|
||
/** | ||
* Remove assets that are specified in filePaths | ||
* @param filePaths a single path or an array of paths corresponding to the assets to remove | ||
*/ | ||
Site.prototype.removeAsset = delay( | ||
Site.prototype._removeMultipleAssets as () => Bluebird<unknown>, 1000); | ||
/** | ||
* Rebuild all pages | ||
*/ | ||
rebuildSourceFiles | ||
= delay(this._rebuildSourceFiles as () => Bluebird<unknown>, 1000) as () => Bluebird<unknown>; | ||
|
||
/** | ||
* Builds pages that are yet to build/rebuild in the background | ||
*/ | ||
Site.prototype.backgroundBuildNotViewedFiles = delay( | ||
Site.prototype._backgroundBuildNotViewedFiles as () => Bluebird<unknown>, 1000); | ||
/** | ||
* Builds pages that are yet to build/rebuild in the background | ||
*/ | ||
backgroundBuildNotViewedFiles | ||
= delay(this._backgroundBuildNotViewedFiles as () => Bluebird<unknown>, 1000) as () => Bluebird<unknown>; | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
hmm, maybe there's something wrong here. I'm not sure why we are rebuilding all source files when one file is added/removed. Anyhow, it's not related to this PR.