forked from rollup/rollup-docs-cn
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve AST garbage collection (#4762)
* Add AST LRU cache * Fix dynamic import AST keep * Refactor implementation * Remove lru config * Fix cache check * Add test for line coverage * Refactor cache check
- Loading branch information
Showing
12 changed files
with
174 additions
and
19 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 |
---|---|---|
|
@@ -247,6 +247,23 @@ Repository: jonschlinkert/fill-range | |
--------------------------------------- | ||
|
||
## flru | ||
License: MIT | ||
By: Luke Edwards | ||
Repository: lukeed/flru | ||
|
||
> MIT License | ||
> | ||
> Copyright (c) Luke Edwards <[email protected]> (lukeed.com) | ||
> | ||
> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
> | ||
> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
> | ||
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
--------------------------------------- | ||
|
||
## glob-parent | ||
License: ISC | ||
By: Gulp Team, Elan Shanker, Blaine Bublitz | ||
|
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 |
---|---|---|
|
@@ -88,6 +88,23 @@ Repository: https://github.com/acornjs/acorn.git | |
--------------------------------------- | ||
|
||
## flru | ||
License: MIT | ||
By: Luke Edwards | ||
Repository: lukeed/flru | ||
|
||
> MIT License | ||
> | ||
> Copyright (c) Luke Edwards <[email protected]> (lukeed.com) | ||
> | ||
> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
> | ||
> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
> | ||
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
--------------------------------------- | ||
|
||
## hash.js | ||
License: MIT | ||
By: Fedor Indutny | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
65 changes: 65 additions & 0 deletions
65
test/function/samples/plugin-module-information-no-cache/_config.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
const assert = require('node:assert'); | ||
const path = require('node:path'); | ||
|
||
const ID_MAIN = path.join(__dirname, 'main.js'); | ||
|
||
module.exports = { | ||
description: 'handles accessing module information via plugins with cache disabled', | ||
options: { | ||
cache: false, | ||
plugins: [ | ||
{ | ||
renderStart() { | ||
const info = this.getModuleInfo(ID_MAIN); | ||
const ast = { | ||
type: 'Program', | ||
start: 0, | ||
end: 19, | ||
body: [ | ||
{ | ||
type: 'ExportDefaultDeclaration', | ||
start: 0, | ||
end: 18, | ||
declaration: { | ||
type: 'Literal', | ||
start: 15, | ||
end: 17, | ||
value: 42, | ||
raw: '42' | ||
} | ||
} | ||
], | ||
sourceType: 'module' | ||
}; | ||
assert.deepStrictEqual(JSON.parse(JSON.stringify(info)), { | ||
assertions: {}, | ||
ast, | ||
code: 'export default 42;\n', | ||
dynamicallyImportedIdResolutions: [], | ||
dynamicallyImportedIds: [], | ||
dynamicImporters: [], | ||
exportedBindings: { | ||
'.': ['default'] | ||
}, | ||
exports: ['default'], | ||
hasDefaultExport: true, | ||
id: ID_MAIN, | ||
implicitlyLoadedAfterOneOf: [], | ||
implicitlyLoadedBefore: [], | ||
importedIdResolutions: [], | ||
importedIds: [], | ||
importers: [], | ||
isEntry: true, | ||
isExternal: false, | ||
isIncluded: true, | ||
meta: {}, | ||
moduleSideEffects: true, | ||
syntheticNamedExports: false | ||
}); | ||
// Call AST again to ensure line coverage for cached getter | ||
assert.deepStrictEqual(JSON.parse(JSON.stringify(info.ast)), ast); | ||
} | ||
} | ||
] | ||
} | ||
}; |
1 change: 1 addition & 0 deletions
1
test/function/samples/plugin-module-information-no-cache/main.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default 42; |