aboutsummaryrefslogtreecommitdiffstats
path: root/build/tasks/lib
diff options
context:
space:
mode:
authorMichał Gołębiowski-Owczarek <m.goleb@gmail.com>2019-12-02 19:55:19 +0100
committerGitHub <noreply@github.com>2019-12-02 19:55:19 +0100
commit9fd2fa5388dba5c71129a1d9e3bb8e4fe6e4eb0b (patch)
tree9e6cd3c8c3a6072235e12a19bd6b6e2b9cd35bc8 /build/tasks/lib
parent44ac8c8529173711b66046ae5cfefa5bd4892461 (diff)
downloadjquery-9fd2fa5388dba5c71129a1d9e3bb8e4fe6e4eb0b.tar.gz
jquery-9fd2fa5388dba5c71129a1d9e3bb8e4fe6e4eb0b.zip
Build: Fix the Windows build
This commit gets rid of rollup-plugin-hypothetical in favor of a simpler inline Rollup plugin that fits our need and is compatible with Windows. Fixes gh-4548 Closes gh-4549
Diffstat (limited to 'build/tasks/lib')
-rw-r--r--build/tasks/lib/rollup-plugin-file-overrides.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/build/tasks/lib/rollup-plugin-file-overrides.js b/build/tasks/lib/rollup-plugin-file-overrides.js
new file mode 100644
index 000000000..c494e4e5d
--- /dev/null
+++ b/build/tasks/lib/rollup-plugin-file-overrides.js
@@ -0,0 +1,24 @@
+"use strict";
+
+/**
+ * A Rollup plugin accepting a file overrides map and changing
+ * module sources to the overridden ones where provided. Files
+ * without overrides are loaded from disk.
+ *
+ * @param {Map<string, string>} fileOverrides
+ */
+module.exports = ( fileOverrides ) => {
+ return {
+ name: "jquery-file-overrides",
+ load( id ) {
+ if ( fileOverrides.has( id ) ) {
+
+ // Replace the module by a fake source.
+ return fileOverrides.get( id );
+ }
+
+ // Handle this module via the file system.
+ return null;
+ }
+ };
+};