mirror of https://github.com/alibaba/ice.git
chore: bump unplugin version (#6750)
* chore: bump unplugin version * chore: remove patch file
This commit is contained in:
parent
3727f80d8f
commit
f7dd9fc53b
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'@ice/bundles': patch
|
||||
---
|
||||
|
||||
fix: bump unplugin verison to 1.6.0
|
||||
|
|
@ -71,7 +71,6 @@
|
|||
"packageManager": "pnpm@8.9.2",
|
||||
"pnpm": {
|
||||
"patchedDependencies": {
|
||||
"unplugin@1.5.1": "patches/unplugin@1.5.1.patch",
|
||||
"@rspack/core@0.4.5": "patches/@rspack__core@0.4.5.patch"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@
|
|||
"webpack": "5.88.2",
|
||||
"webpack-bundle-analyzer": "4.5.0",
|
||||
"webpack-dev-server": "4.15.0",
|
||||
"unplugin": "1.5.1",
|
||||
"unplugin": "1.6.0",
|
||||
"bonjour-service": "^1.0.13",
|
||||
"colorette": "^2.0.10",
|
||||
"compression": "^1.7.4",
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@
|
|||
"react": "^18.2.0",
|
||||
"react-router": "6.14.2",
|
||||
"sass": "^1.50.0",
|
||||
"unplugin": "^1.5.1",
|
||||
"unplugin": "^1.6.0",
|
||||
"webpack": "^5.88.0",
|
||||
"webpack-dev-server": "4.15.0",
|
||||
"@rspack/core": "0.4.5",
|
||||
|
|
|
|||
|
|
@ -1,457 +0,0 @@
|
|||
diff --git a/dist/index.d.mts b/dist/index.d.mts
|
||||
index 524216f7a6d07c6fb1000cbfaf864087c18c07d6..5f0c400b14c4d53032071963cf1844a2c77b8a1b 100644
|
||||
--- a/dist/index.d.mts
|
||||
+++ b/dist/index.d.mts
|
||||
@@ -116,6 +116,11 @@ declare module 'webpack' {
|
||||
$unpluginContext: Record<string, ResolvedUnpluginOptions>;
|
||||
}
|
||||
}
|
||||
+declare module '@rspack/core' {
|
||||
+ interface Compiler {
|
||||
+ $unpluginContext: Record<string, ResolvedUnpluginOptions>;
|
||||
+ }
|
||||
+}
|
||||
|
||||
declare function createUnplugin<UserOptions, Nested extends boolean = boolean>(factory: UnpluginFactory<UserOptions, Nested>): UnpluginInstance<UserOptions, Nested>;
|
||||
declare function createEsbuildPlugin<UserOptions, Nested extends boolean = boolean>(factory: UnpluginFactory<UserOptions, Nested>): UnpluginFactoryOutput<UserOptions, esbuild.Plugin>;
|
||||
diff --git a/dist/index.d.ts b/dist/index.d.ts
|
||||
index 524216f7a6d07c6fb1000cbfaf864087c18c07d6..5f0c400b14c4d53032071963cf1844a2c77b8a1b 100644
|
||||
--- a/dist/index.d.ts
|
||||
+++ b/dist/index.d.ts
|
||||
@@ -116,6 +116,11 @@ declare module 'webpack' {
|
||||
$unpluginContext: Record<string, ResolvedUnpluginOptions>;
|
||||
}
|
||||
}
|
||||
+declare module '@rspack/core' {
|
||||
+ interface Compiler {
|
||||
+ $unpluginContext: Record<string, ResolvedUnpluginOptions>;
|
||||
+ }
|
||||
+}
|
||||
|
||||
declare function createUnplugin<UserOptions, Nested extends boolean = boolean>(factory: UnpluginFactory<UserOptions, Nested>): UnpluginInstance<UserOptions, Nested>;
|
||||
declare function createEsbuildPlugin<UserOptions, Nested extends boolean = boolean>(factory: UnpluginFactory<UserOptions, Nested>): UnpluginFactoryOutput<UserOptions, esbuild.Plugin>;
|
||||
diff --git a/dist/index.js b/dist/index.js
|
||||
index e2ae29096208ae06c2e36fd123ee42585c798da1..2166e91885b7ae53e22028142c188489485f5fea 100644
|
||||
--- a/dist/index.js
|
||||
+++ b/dist/index.js
|
||||
@@ -1135,6 +1135,24 @@ function toArray(array) {
|
||||
return array;
|
||||
return [array];
|
||||
}
|
||||
+function shouldLoad(id, plugin, externalModules) {
|
||||
+ if (id.startsWith(plugin.__virtualModulePrefix))
|
||||
+ id = decodeURIComponent(id.slice(plugin.__virtualModulePrefix.length));
|
||||
+ if (plugin.loadInclude && !plugin.loadInclude(id))
|
||||
+ return false;
|
||||
+ return !externalModules.has(id);
|
||||
+}
|
||||
+function transformUse(data, plugin, transformLoader) {
|
||||
+ if (data.resource == null)
|
||||
+ return [];
|
||||
+ const id = normalizeAbsolutePath(data.resource + (data.resourceQuery || ""));
|
||||
+ if (!plugin.transformInclude || plugin.transformInclude(id)) {
|
||||
+ return [{
|
||||
+ loader: `${transformLoader}?unpluginName=${encodeURIComponent(plugin.name)}`
|
||||
+ }];
|
||||
+ }
|
||||
+ return [];
|
||||
+}
|
||||
|
||||
// src/esbuild/utils.ts
|
||||
var ExtToLoader = {
|
||||
@@ -1430,16 +1448,19 @@ function createRspackContext(compilation) {
|
||||
// src/rspack/index.ts
|
||||
var TRANSFORM_LOADER = (0, import_path4.resolve)(
|
||||
__dirname,
|
||||
- false ? "../../dist/rspack/loaders/transform" : "rspack/loaders/transform"
|
||||
+ false ? "../../dist/rspack/loaders/transform.js" : "rspack/loaders/transform"
|
||||
);
|
||||
var LOAD_LOADER = (0, import_path4.resolve)(
|
||||
__dirname,
|
||||
false ? "../../dist/rspack/loaders/load" : "rspack/loaders/load"
|
||||
);
|
||||
+var VIRTUAL_MODULE_PREFIX = (0, import_path4.resolve)(process.cwd(), "_virtual_");
|
||||
function getRspackPlugin(factory) {
|
||||
return (userOptions) => {
|
||||
return {
|
||||
apply(compiler) {
|
||||
+ const injected = compiler.$unpluginContext || {};
|
||||
+ compiler.$unpluginContext = injected;
|
||||
const meta = {
|
||||
framework: "rspack",
|
||||
rspack: {
|
||||
@@ -1447,27 +1468,43 @@ function getRspackPlugin(factory) {
|
||||
}
|
||||
};
|
||||
const rawPlugins = toArray(factory(userOptions, meta));
|
||||
- for (const plugin of rawPlugins) {
|
||||
+ for (const rawPlugin of rawPlugins) {
|
||||
+ const plugin = Object.assign(
|
||||
+ rawPlugin,
|
||||
+ {
|
||||
+ __unpluginMeta: meta,
|
||||
+ __virtualModulePrefix: VIRTUAL_MODULE_PREFIX
|
||||
+ }
|
||||
+ );
|
||||
+ injected[plugin.name] = plugin;
|
||||
+ compiler.hooks.thisCompilation.tap(plugin.name, (compilation) => {
|
||||
+ if (typeof compilation.hooks.childCompiler === "undefined")
|
||||
+ throw new Error("`compilation.hooks.childCompiler` only support by @rspack/core>=0.4.1");
|
||||
+ compilation.hooks.childCompiler.tap(plugin.name, (childCompiler) => {
|
||||
+ childCompiler.$unpluginContext = injected;
|
||||
+ });
|
||||
+ });
|
||||
+ const externalModules = /* @__PURE__ */ new Set();
|
||||
if (plugin.load) {
|
||||
- const use = {
|
||||
- loader: LOAD_LOADER,
|
||||
- options: { plugin }
|
||||
- };
|
||||
compiler.options.module.rules.unshift({
|
||||
enforce: plugin.enforce,
|
||||
- include: /.*/,
|
||||
- use
|
||||
+ include(id) {
|
||||
+ return shouldLoad(id, plugin, externalModules);
|
||||
+ },
|
||||
+ use: [{
|
||||
+ loader: LOAD_LOADER,
|
||||
+ options: {
|
||||
+ unpluginName: plugin.name
|
||||
+ }
|
||||
+ }]
|
||||
});
|
||||
}
|
||||
if (plugin.transform) {
|
||||
- const use = {
|
||||
- loader: TRANSFORM_LOADER,
|
||||
- options: { plugin }
|
||||
- };
|
||||
compiler.options.module.rules.unshift({
|
||||
enforce: plugin.enforce,
|
||||
- include: /.*/,
|
||||
- use
|
||||
+ use(data) {
|
||||
+ return transformUse(data, plugin, TRANSFORM_LOADER);
|
||||
+ }
|
||||
});
|
||||
}
|
||||
if (plugin.rspack)
|
||||
@@ -1570,7 +1607,7 @@ var LOAD_LOADER2 = (0, import_path6.resolve)(
|
||||
__dirname,
|
||||
false ? "../../dist/webpack/loaders/load" : "webpack/loaders/load"
|
||||
);
|
||||
-var VIRTUAL_MODULE_PREFIX = (0, import_path6.resolve)(import_process2.default.cwd(), "_virtual_");
|
||||
+var VIRTUAL_MODULE_PREFIX2 = (0, import_path6.resolve)(import_process2.default.cwd(), "_virtual_");
|
||||
function getWebpackPlugin(factory) {
|
||||
return (userOptions) => {
|
||||
return {
|
||||
@@ -1589,7 +1626,7 @@ function getWebpackPlugin(factory) {
|
||||
rawPlugin,
|
||||
{
|
||||
__unpluginMeta: meta,
|
||||
- __virtualModulePrefix: VIRTUAL_MODULE_PREFIX
|
||||
+ __virtualModulePrefix: VIRTUAL_MODULE_PREFIX2
|
||||
}
|
||||
);
|
||||
injected[plugin.name] = plugin;
|
||||
@@ -1650,11 +1687,7 @@ function getWebpackPlugin(factory) {
|
||||
if (plugin.load) {
|
||||
compiler.options.module.rules.unshift({
|
||||
include(id) {
|
||||
- if (id.startsWith(plugin.__virtualModulePrefix))
|
||||
- id = decodeURIComponent(id.slice(plugin.__virtualModulePrefix.length));
|
||||
- if (plugin.loadInclude && !plugin.loadInclude(id))
|
||||
- return false;
|
||||
- return !externalModules.has(id);
|
||||
+ return shouldLoad(id, plugin, externalModules);
|
||||
},
|
||||
enforce: plugin.enforce,
|
||||
use: [{
|
||||
@@ -1666,19 +1699,10 @@ function getWebpackPlugin(factory) {
|
||||
});
|
||||
}
|
||||
if (plugin.transform) {
|
||||
- const useLoader = [{
|
||||
- loader: `${TRANSFORM_LOADER2}?unpluginName=${encodeURIComponent(plugin.name)}`
|
||||
- }];
|
||||
- const useNone = [];
|
||||
compiler.options.module.rules.unshift({
|
||||
enforce: plugin.enforce,
|
||||
- use: (data) => {
|
||||
- if (data.resource == null)
|
||||
- return useNone;
|
||||
- const id = normalizeAbsolutePath(data.resource + (data.resourceQuery || ""));
|
||||
- if (!plugin.transformInclude || plugin.transformInclude(id))
|
||||
- return useLoader;
|
||||
- return useNone;
|
||||
+ use(data) {
|
||||
+ return transformUse(data, plugin, TRANSFORM_LOADER2);
|
||||
}
|
||||
});
|
||||
}
|
||||
diff --git a/dist/index.mjs b/dist/index.mjs
|
||||
index f815c05c279126543cdd40ec879b0c95b92a8d03..c1caae0c0bb82515ff419c244b20a67fc375efb6 100644
|
||||
--- a/dist/index.mjs
|
||||
+++ b/dist/index.mjs
|
||||
@@ -1101,6 +1101,24 @@ function toArray(array) {
|
||||
return array;
|
||||
return [array];
|
||||
}
|
||||
+function shouldLoad(id, plugin, externalModules) {
|
||||
+ if (id.startsWith(plugin.__virtualModulePrefix))
|
||||
+ id = decodeURIComponent(id.slice(plugin.__virtualModulePrefix.length));
|
||||
+ if (plugin.loadInclude && !plugin.loadInclude(id))
|
||||
+ return false;
|
||||
+ return !externalModules.has(id);
|
||||
+}
|
||||
+function transformUse(data, plugin, transformLoader) {
|
||||
+ if (data.resource == null)
|
||||
+ return [];
|
||||
+ const id = normalizeAbsolutePath(data.resource + (data.resourceQuery || ""));
|
||||
+ if (!plugin.transformInclude || plugin.transformInclude(id)) {
|
||||
+ return [{
|
||||
+ loader: `${transformLoader}?unpluginName=${encodeURIComponent(plugin.name)}`
|
||||
+ }];
|
||||
+ }
|
||||
+ return [];
|
||||
+}
|
||||
|
||||
// src/esbuild/utils.ts
|
||||
var ExtToLoader = {
|
||||
@@ -1396,16 +1414,19 @@ function createRspackContext(compilation) {
|
||||
// src/rspack/index.ts
|
||||
var TRANSFORM_LOADER = resolve3(
|
||||
__dirname,
|
||||
- false ? "../../dist/rspack/loaders/transform" : "rspack/loaders/transform"
|
||||
+ false ? "../../dist/rspack/loaders/transform.js" : "rspack/loaders/transform"
|
||||
);
|
||||
var LOAD_LOADER = resolve3(
|
||||
__dirname,
|
||||
false ? "../../dist/rspack/loaders/load" : "rspack/loaders/load"
|
||||
);
|
||||
+var VIRTUAL_MODULE_PREFIX = resolve3(process.cwd(), "_virtual_");
|
||||
function getRspackPlugin(factory) {
|
||||
return (userOptions) => {
|
||||
return {
|
||||
apply(compiler) {
|
||||
+ const injected = compiler.$unpluginContext || {};
|
||||
+ compiler.$unpluginContext = injected;
|
||||
const meta = {
|
||||
framework: "rspack",
|
||||
rspack: {
|
||||
@@ -1413,27 +1434,43 @@ function getRspackPlugin(factory) {
|
||||
}
|
||||
};
|
||||
const rawPlugins = toArray(factory(userOptions, meta));
|
||||
- for (const plugin of rawPlugins) {
|
||||
+ for (const rawPlugin of rawPlugins) {
|
||||
+ const plugin = Object.assign(
|
||||
+ rawPlugin,
|
||||
+ {
|
||||
+ __unpluginMeta: meta,
|
||||
+ __virtualModulePrefix: VIRTUAL_MODULE_PREFIX
|
||||
+ }
|
||||
+ );
|
||||
+ injected[plugin.name] = plugin;
|
||||
+ compiler.hooks.thisCompilation.tap(plugin.name, (compilation) => {
|
||||
+ if (typeof compilation.hooks.childCompiler === "undefined")
|
||||
+ throw new Error("`compilation.hooks.childCompiler` only support by @rspack/core>=0.4.1");
|
||||
+ compilation.hooks.childCompiler.tap(plugin.name, (childCompiler) => {
|
||||
+ childCompiler.$unpluginContext = injected;
|
||||
+ });
|
||||
+ });
|
||||
+ const externalModules = /* @__PURE__ */ new Set();
|
||||
if (plugin.load) {
|
||||
- const use = {
|
||||
- loader: LOAD_LOADER,
|
||||
- options: { plugin }
|
||||
- };
|
||||
compiler.options.module.rules.unshift({
|
||||
enforce: plugin.enforce,
|
||||
- include: /.*/,
|
||||
- use
|
||||
+ include(id) {
|
||||
+ return shouldLoad(id, plugin, externalModules);
|
||||
+ },
|
||||
+ use: [{
|
||||
+ loader: LOAD_LOADER,
|
||||
+ options: {
|
||||
+ unpluginName: plugin.name
|
||||
+ }
|
||||
+ }]
|
||||
});
|
||||
}
|
||||
if (plugin.transform) {
|
||||
- const use = {
|
||||
- loader: TRANSFORM_LOADER,
|
||||
- options: { plugin }
|
||||
- };
|
||||
compiler.options.module.rules.unshift({
|
||||
enforce: plugin.enforce,
|
||||
- include: /.*/,
|
||||
- use
|
||||
+ use(data) {
|
||||
+ return transformUse(data, plugin, TRANSFORM_LOADER);
|
||||
+ }
|
||||
});
|
||||
}
|
||||
if (plugin.rspack)
|
||||
@@ -1480,13 +1517,13 @@ function getVitePlugin(factory) {
|
||||
// src/webpack/index.ts
|
||||
import fs3 from "fs";
|
||||
import { resolve as resolve5 } from "path";
|
||||
-import process2 from "process";
|
||||
+import process3 from "process";
|
||||
import VirtualModulesPlugin from "webpack-virtual-modules";
|
||||
|
||||
// src/webpack/context.ts
|
||||
import { resolve as resolve4 } from "path";
|
||||
import { Buffer as Buffer4 } from "buffer";
|
||||
-import process from "process";
|
||||
+import process2 from "process";
|
||||
import sources2 from "webpack-sources";
|
||||
import { Parser as Parser3 } from "acorn";
|
||||
function createContext(compilation) {
|
||||
@@ -1501,7 +1538,7 @@ function createContext(compilation) {
|
||||
},
|
||||
addWatchFile(id) {
|
||||
(compilation.fileDependencies ?? compilation.compilationDependencies).add(
|
||||
- resolve4(process.cwd(), id)
|
||||
+ resolve4(process2.cwd(), id)
|
||||
);
|
||||
},
|
||||
emitFile(emittedFile) {
|
||||
@@ -1536,7 +1573,7 @@ var LOAD_LOADER2 = resolve5(
|
||||
__dirname,
|
||||
false ? "../../dist/webpack/loaders/load" : "webpack/loaders/load"
|
||||
);
|
||||
-var VIRTUAL_MODULE_PREFIX = resolve5(process2.cwd(), "_virtual_");
|
||||
+var VIRTUAL_MODULE_PREFIX2 = resolve5(process3.cwd(), "_virtual_");
|
||||
function getWebpackPlugin(factory) {
|
||||
return (userOptions) => {
|
||||
return {
|
||||
@@ -1555,7 +1592,7 @@ function getWebpackPlugin(factory) {
|
||||
rawPlugin,
|
||||
{
|
||||
__unpluginMeta: meta,
|
||||
- __virtualModulePrefix: VIRTUAL_MODULE_PREFIX
|
||||
+ __virtualModulePrefix: VIRTUAL_MODULE_PREFIX2
|
||||
}
|
||||
);
|
||||
injected[plugin.name] = plugin;
|
||||
@@ -1616,11 +1653,7 @@ function getWebpackPlugin(factory) {
|
||||
if (plugin.load) {
|
||||
compiler.options.module.rules.unshift({
|
||||
include(id) {
|
||||
- if (id.startsWith(plugin.__virtualModulePrefix))
|
||||
- id = decodeURIComponent(id.slice(plugin.__virtualModulePrefix.length));
|
||||
- if (plugin.loadInclude && !plugin.loadInclude(id))
|
||||
- return false;
|
||||
- return !externalModules.has(id);
|
||||
+ return shouldLoad(id, plugin, externalModules);
|
||||
},
|
||||
enforce: plugin.enforce,
|
||||
use: [{
|
||||
@@ -1632,19 +1665,10 @@ function getWebpackPlugin(factory) {
|
||||
});
|
||||
}
|
||||
if (plugin.transform) {
|
||||
- const useLoader = [{
|
||||
- loader: `${TRANSFORM_LOADER2}?unpluginName=${encodeURIComponent(plugin.name)}`
|
||||
- }];
|
||||
- const useNone = [];
|
||||
compiler.options.module.rules.unshift({
|
||||
enforce: plugin.enforce,
|
||||
- use: (data) => {
|
||||
- if (data.resource == null)
|
||||
- return useNone;
|
||||
- const id = normalizeAbsolutePath(data.resource + (data.resourceQuery || ""));
|
||||
- if (!plugin.transformInclude || plugin.transformInclude(id))
|
||||
- return useLoader;
|
||||
- return useNone;
|
||||
+ use(data) {
|
||||
+ return transformUse(data, plugin, TRANSFORM_LOADER2);
|
||||
}
|
||||
});
|
||||
}
|
||||
diff --git a/dist/rspack/loaders/load.js b/dist/rspack/loaders/load.js
|
||||
index 0587e3d6a1b44e10a022a04b3397b2f6e9ec2fb9..4ad1c2fdf35b9970ff8669c093e078d9f62ae2a4 100644
|
||||
--- a/dist/rspack/loaders/load.js
|
||||
+++ b/dist/rspack/loaders/load.js
|
||||
@@ -80,8 +80,9 @@ function normalizeAbsolutePath(path) {
|
||||
// src/rspack/loaders/load.ts
|
||||
async function load(source, map) {
|
||||
const callback = this.async();
|
||||
+ const { unpluginName } = this.query;
|
||||
+ const plugin = this._compiler?.$unpluginContext[unpluginName];
|
||||
const id = this.resource;
|
||||
- const { plugin } = this.getOptions();
|
||||
if (!plugin?.load || !id)
|
||||
return callback(null, source, map);
|
||||
if (plugin.loadInclude && !plugin.loadInclude(id))
|
||||
diff --git a/dist/rspack/loaders/load.mjs b/dist/rspack/loaders/load.mjs
|
||||
index 4a3f6d10edc8bcd4b1c3a37a0f3af8dcee893f1f..f3f6e57129c9c17fc15d4a80815e53106ce8023a 100644
|
||||
--- a/dist/rspack/loaders/load.mjs
|
||||
+++ b/dist/rspack/loaders/load.mjs
|
||||
@@ -44,8 +44,9 @@ function normalizeAbsolutePath(path) {
|
||||
// src/rspack/loaders/load.ts
|
||||
async function load(source, map) {
|
||||
const callback = this.async();
|
||||
+ const { unpluginName } = this.query;
|
||||
+ const plugin = this._compiler?.$unpluginContext[unpluginName];
|
||||
const id = this.resource;
|
||||
- const { plugin } = this.getOptions();
|
||||
if (!plugin?.load || !id)
|
||||
return callback(null, source, map);
|
||||
if (plugin.loadInclude && !plugin.loadInclude(id))
|
||||
diff --git a/dist/rspack/loaders/transform.js b/dist/rspack/loaders/transform.js
|
||||
index 21ffe0b8056ac063a80beca1c41eb54285b10551..0a24cb09de77b3ab534da7e9827995544f8d182b 100644
|
||||
--- a/dist/rspack/loaders/transform.js
|
||||
+++ b/dist/rspack/loaders/transform.js
|
||||
@@ -71,12 +71,17 @@ function createRspackContext(compilation) {
|
||||
// src/rspack/loaders/transform.ts
|
||||
async function transform(source, map) {
|
||||
const callback = this.async();
|
||||
+ let unpluginName;
|
||||
+ if (typeof this.query === "string") {
|
||||
+ const query = new URLSearchParams(this.query);
|
||||
+ unpluginName = query.get("unpluginName");
|
||||
+ } else {
|
||||
+ unpluginName = this.query.unpluginName;
|
||||
+ }
|
||||
const id = this.resource;
|
||||
- const { plugin } = this.getOptions();
|
||||
+ const plugin = this._compiler?.$unpluginContext[unpluginName];
|
||||
if (!plugin?.transform)
|
||||
return callback(null, source, map);
|
||||
- if (plugin.transformInclude && !plugin.transformInclude(id))
|
||||
- return callback(null, source, map);
|
||||
const context = {
|
||||
error: (error) => this.emitError(typeof error === "string" ? new Error(error) : error),
|
||||
warn: (error) => this.emitWarning(typeof error === "string" ? new Error(error) : error)
|
||||
diff --git a/dist/rspack/loaders/transform.mjs b/dist/rspack/loaders/transform.mjs
|
||||
index c5c1957cb516acf989fa15d4eebfcabebcfa9541..d023ff719d1ddf5d5ade369614cfbcb5870d843b 100644
|
||||
--- a/dist/rspack/loaders/transform.mjs
|
||||
+++ b/dist/rspack/loaders/transform.mjs
|
||||
@@ -35,12 +35,17 @@ function createRspackContext(compilation) {
|
||||
// src/rspack/loaders/transform.ts
|
||||
async function transform(source, map) {
|
||||
const callback = this.async();
|
||||
+ let unpluginName;
|
||||
+ if (typeof this.query === "string") {
|
||||
+ const query = new URLSearchParams(this.query);
|
||||
+ unpluginName = query.get("unpluginName");
|
||||
+ } else {
|
||||
+ unpluginName = this.query.unpluginName;
|
||||
+ }
|
||||
const id = this.resource;
|
||||
- const { plugin } = this.getOptions();
|
||||
+ const plugin = this._compiler?.$unpluginContext[unpluginName];
|
||||
if (!plugin?.transform)
|
||||
return callback(null, source, map);
|
||||
- if (plugin.transformInclude && !plugin.transformInclude(id))
|
||||
- return callback(null, source, map);
|
||||
const context = {
|
||||
error: (error) => this.emitError(typeof error === "string" ? new Error(error) : error),
|
||||
warn: (error) => this.emitWarning(typeof error === "string" ? new Error(error) : error)
|
||||
|
|
@ -8,9 +8,6 @@ patchedDependencies:
|
|||
'@rspack/core@0.4.5':
|
||||
hash: vl6m5tsr4v2bh4wx2ltp22ktf4
|
||||
path: patches/@rspack__core@0.4.5.patch
|
||||
unplugin@1.5.1:
|
||||
hash: eanypstkeladyqkfllfbryx6lu
|
||||
path: patches/unplugin@1.5.1.patch
|
||||
|
||||
importers:
|
||||
|
||||
|
|
@ -1541,8 +1538,8 @@ importers:
|
|||
specifier: ^4.6.4
|
||||
version: 4.9.5
|
||||
unplugin:
|
||||
specifier: 1.5.1
|
||||
version: 1.5.1(patch_hash=eanypstkeladyqkfllfbryx6lu)
|
||||
specifier: 1.6.0
|
||||
version: 1.6.0
|
||||
webpack:
|
||||
specifier: 5.88.2
|
||||
version: 5.88.2(@swc/core@1.3.80)(esbuild@0.17.16)
|
||||
|
|
@ -1748,8 +1745,8 @@ importers:
|
|||
specifier: ^1.50.0
|
||||
version: 1.50.0
|
||||
unplugin:
|
||||
specifier: ^1.5.1
|
||||
version: 1.5.1(patch_hash=eanypstkeladyqkfllfbryx6lu)
|
||||
specifier: ^1.6.0
|
||||
version: 1.6.0
|
||||
webpack:
|
||||
specifier: ^5.88.0
|
||||
version: 5.88.2(esbuild@0.17.16)
|
||||
|
|
@ -9665,7 +9662,7 @@ packages:
|
|||
chokidar: 3.5.3
|
||||
fast-glob: 3.3.2
|
||||
magic-string: 0.30.5
|
||||
unplugin: 1.5.1(patch_hash=eanypstkeladyqkfllfbryx6lu)
|
||||
unplugin: 1.6.0
|
||||
webpack: 5.88.2
|
||||
webpack-sources: 3.2.3
|
||||
transitivePeerDependencies:
|
||||
|
|
@ -23175,7 +23172,7 @@ packages:
|
|||
pkg-types: 1.0.3
|
||||
scule: 1.1.0
|
||||
strip-literal: 1.3.0
|
||||
unplugin: 1.5.1(patch_hash=eanypstkeladyqkfllfbryx6lu)
|
||||
unplugin: 1.6.0
|
||||
transitivePeerDependencies:
|
||||
- rollup
|
||||
dev: true
|
||||
|
|
@ -23378,14 +23375,13 @@ packages:
|
|||
resolution: {integrity: sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==}
|
||||
engines: {node: '>= 0.8'}
|
||||
|
||||
/unplugin@1.5.1(patch_hash=eanypstkeladyqkfllfbryx6lu):
|
||||
resolution: {integrity: sha512-0QkvG13z6RD+1L1FoibQqnvTwVBXvS4XSPwAyinVgoOCl2jAgwzdUKmEj05o4Lt8xwQI85Hb6mSyYkcAGwZPew==}
|
||||
/unplugin@1.6.0:
|
||||
resolution: {integrity: sha512-BfJEpWBu3aE/AyHx8VaNE/WgouoQxgH9baAiH82JjX8cqVyi3uJQstqwD5J+SZxIK326SZIhsSZlALXVBCknTQ==}
|
||||
dependencies:
|
||||
acorn: 8.11.2
|
||||
chokidar: 3.5.3
|
||||
webpack-sources: 3.2.3
|
||||
webpack-virtual-modules: 0.6.0
|
||||
patched: true
|
||||
webpack-virtual-modules: 0.6.1
|
||||
|
||||
/unquote@1.1.1:
|
||||
resolution: {integrity: sha512-vRCqFv6UhXpWxZPyGDh/F3ZpNv8/qo7w6iufLpQg9aKnQ71qM4B5KiI7Mia9COcjEhrO9LueHpMYjYzsWH3OIg==}
|
||||
|
|
@ -24185,8 +24181,8 @@ packages:
|
|||
resolution: {integrity: sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==}
|
||||
engines: {node: '>=10.13.0'}
|
||||
|
||||
/webpack-virtual-modules@0.6.0:
|
||||
resolution: {integrity: sha512-KnaMTE6EItz/f2q4Gwg5/rmeKVi79OR58NoYnwDJqCk9ywMtTGbBnBcfoBtN4QbYu0lWXvyMoH2Owxuhe4qI6Q==}
|
||||
/webpack-virtual-modules@0.6.1:
|
||||
resolution: {integrity: sha512-poXpCylU7ExuvZK8z+On3kX+S8o/2dQ/SVYueKA0D4WEMXROXgY8Ez50/bQEUmvoSMMrWcrJqCHuhAbsiwg7Dg==}
|
||||
|
||||
/webpack@5.76.0(@swc/core@1.3.80)(esbuild@0.17.16):
|
||||
resolution: {integrity: sha512-l5sOdYBDunyf72HW8dF23rFtWq/7Zgvt/9ftMof71E/yUb1YLOBmTgA2K4vQthB3kotMrSj609txVE0dnr2fjA==}
|
||||
|
|
|
|||
Loading…
Reference in New Issue