-
-
Notifications
You must be signed in to change notification settings - Fork 600
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support
output.compareBeforeEmit
(#8245)
- Loading branch information
1 parent
a50b5d9
commit ef40355
Showing
18 changed files
with
194 additions
and
14 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
36 changes: 36 additions & 0 deletions
36
packages/rspack-test-tools/tests/compilerCases/compare-before-emit-disable.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,36 @@ | ||
const path = require("path"); | ||
const fs = require("fs"); | ||
const rimraf = require("rimraf"); | ||
|
||
let first_asset_mtime; | ||
|
||
/** @type {import('../../dist').TCompilerCaseConfig} */ | ||
module.exports = { | ||
description: "should write same content to same file", | ||
options(context) { | ||
return { | ||
output: { | ||
path: context.getDist(), | ||
filename: "main.js", | ||
compareBeforeEmit: false | ||
}, | ||
context: context.getSource(), | ||
entry: "./d", | ||
}; | ||
}, | ||
async build(context, compiler) { | ||
rimraf.sync(context.getDist()); | ||
await new Promise(resolve => { | ||
compiler.run(() => { | ||
first_asset_mtime = fs.statSync(path.join(context.getDist("main.js")))?.mtime; | ||
compiler.run(() => { | ||
resolve(); | ||
}); | ||
}); | ||
}); | ||
}, | ||
async check(context) { | ||
let second_asset_mtime = fs.statSync(path.join(context.getDist("main.js")))?.mtime; | ||
expect(first_asset_mtime).not.toEqual(second_asset_mtime); | ||
} | ||
}; |
35 changes: 35 additions & 0 deletions
35
packages/rspack-test-tools/tests/compilerCases/compare-before-emit.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,35 @@ | ||
const path = require("path"); | ||
const fs = require("fs"); | ||
const rimraf = require("rimraf"); | ||
|
||
let first_asset_mtime; | ||
|
||
/** @type {import('../..').TCompilerCaseConfig} */ | ||
module.exports = { | ||
description: "should write emit same content to same file", | ||
options(context) { | ||
return { | ||
output: { | ||
path: context.getDist(), | ||
filename: "main.js", | ||
}, | ||
context: context.getSource(), | ||
entry: "./d", | ||
}; | ||
}, | ||
async build(context, compiler) { | ||
rimraf.sync(context.getDist()); | ||
await new Promise(resolve => { | ||
compiler.run(() => { | ||
first_asset_mtime = fs.statSync(path.join(context.getDist("main.js")))?.mtime; | ||
compiler.run(() => { | ||
resolve(); | ||
}); | ||
}); | ||
}); | ||
}, | ||
async check(context) { | ||
let second_asset_mtime = fs.statSync(path.join(context.getDist("main.js")))?.mtime; | ||
expect(first_asset_mtime).toEqual(second_asset_mtime); | ||
} | ||
}; |
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
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
Oops, something went wrong.
ef40355
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.
📝 Ran ecosystem CI: Open
ef40355
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.
📝 Benchmark detail: Open