use Rule.extractSourceMap
This commit is contained in:
parent
4651b265c1
commit
3d254d6ddc
|
@ -1367,6 +1367,10 @@ export interface RuleSetRule {
|
|||
* Shortcut for resource.exclude.
|
||||
*/
|
||||
exclude?: RuleSetConditionOrConditionsAbsolute;
|
||||
/**
|
||||
* Enable/Disable extracting source map.
|
||||
*/
|
||||
extractSourceMap?: boolean;
|
||||
/**
|
||||
* The options for the module generator.
|
||||
*/
|
||||
|
@ -3082,10 +3086,6 @@ export interface JavascriptParserOptions {
|
|||
* Set the default request for full dynamic dependencies.
|
||||
*/
|
||||
exprContextRequest?: string;
|
||||
/**
|
||||
* Enable/Disable extracting source map.
|
||||
*/
|
||||
extractSourceMap?: boolean;
|
||||
/**
|
||||
* Enable/disable parsing of EcmaScript Modules syntax.
|
||||
*/
|
||||
|
|
|
@ -145,8 +145,9 @@ class Module extends DependenciesBlock {
|
|||
* @param {ModuleTypes | ""} type the module type, when deserializing the type is not known and is an empty string
|
||||
* @param {(string | null)=} context an optional context
|
||||
* @param {(string | null)=} layer an optional layer in which the module is
|
||||
* @param {boolean=} extractSourceMap should try to extract source map
|
||||
*/
|
||||
constructor(type, context = null, layer = null) {
|
||||
constructor(type, context = null, layer = null, extractSourceMap = false) {
|
||||
super();
|
||||
|
||||
/** @type {ModuleTypes} */
|
||||
|
@ -173,6 +174,8 @@ class Module extends DependenciesBlock {
|
|||
this.useSourceMap = false;
|
||||
/** @type {boolean} */
|
||||
this.useSimpleSourceMap = false;
|
||||
/** @type {boolean} */
|
||||
this.extractSourceMap = extractSourceMap;
|
||||
|
||||
// Info from Build
|
||||
/** @type {WebpackError[] | undefined} */
|
||||
|
|
|
@ -204,6 +204,7 @@ makeSerializable(
|
|||
* @typedef {Object} NormalModuleCreateData
|
||||
* @property {string=} layer an optional layer in which the module is
|
||||
* @property {JavaScriptModuleTypes | ""} type module type. When deserializing, this is set to an empty string "".
|
||||
* @property {boolean=} extractSourceMap should try to extract source map
|
||||
* @property {string} request request string
|
||||
* @property {string} userRequest request intended by user (without loaders from config)
|
||||
* @property {string} rawRequest request without resolving
|
||||
|
@ -274,6 +275,7 @@ class NormalModule extends Module {
|
|||
* @param {NormalModuleCreateData} options options object
|
||||
*/
|
||||
constructor({
|
||||
extractSourceMap,
|
||||
layer,
|
||||
type,
|
||||
request,
|
||||
|
@ -290,7 +292,7 @@ class NormalModule extends Module {
|
|||
generatorOptions,
|
||||
resolveOptions
|
||||
}) {
|
||||
super(type, context || getContext(resource), layer);
|
||||
super(type, context || getContext(resource), layer, extractSourceMap);
|
||||
|
||||
// Info from Factory
|
||||
/** @type {string} */
|
||||
|
@ -838,7 +840,7 @@ class NormalModule extends Module {
|
|||
if (typeof result !== "string" && !result) {
|
||||
return callback(new UnhandledSchemeError(scheme, resource));
|
||||
}
|
||||
if (this.parserOptions && this.parserOptions.extractSourceMap) {
|
||||
if (this.extractSourceMap) {
|
||||
return extractSourceMap(
|
||||
result.toString("utf-8"),
|
||||
loaderContext.fs,
|
||||
|
|
|
@ -45,7 +45,7 @@ const {
|
|||
/** @typedef {import("./dependencies/ModuleDependency")} ModuleDependency */
|
||||
/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */
|
||||
|
||||
/** @typedef {Pick<RuleSetRule, 'type'|'sideEffects'|'parser'|'generator'|'resolve'|'layer'>} ModuleSettings */
|
||||
/** @typedef {Pick<RuleSetRule, 'type'|'sideEffects'|'parser'|'generator'|'resolve'|'layer'|'extractSourceMap'>} ModuleSettings */
|
||||
/** @typedef {Partial<NormalModuleCreateData & {settings: ModuleSettings}>} CreateData */
|
||||
|
||||
/**
|
||||
|
@ -183,6 +183,7 @@ const ruleSetCompiler = new RuleSetCompiler([
|
|||
new BasicEffectRulePlugin("resolve"),
|
||||
new BasicEffectRulePlugin("generator"),
|
||||
new BasicEffectRulePlugin("layer"),
|
||||
new BasicEffectRulePlugin("extractSourceMap"),
|
||||
new UseEffectRulePlugin()
|
||||
]);
|
||||
|
||||
|
@ -580,6 +581,7 @@ class NormalModuleFactory extends ModuleFactory {
|
|||
}
|
||||
try {
|
||||
Object.assign(data.createData, {
|
||||
extractSourceMap: settings.extractSourceMap || false,
|
||||
layer:
|
||||
layer === undefined ? contextInfo.issuerLayer || null : layer,
|
||||
request: stringifyLoadersAndResource(
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1724,10 +1724,6 @@
|
|||
"description": "Set the default request for full dynamic dependencies.",
|
||||
"type": "string"
|
||||
},
|
||||
"extractSourceMap": {
|
||||
"description": "Enable/Disable extracting source map.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"harmony": {
|
||||
"description": "Enable/disable parsing of EcmaScript Modules syntax.",
|
||||
"type": "boolean"
|
||||
|
@ -4281,6 +4277,10 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"extractSourceMap": {
|
||||
"description": "Enable/Disable extracting source map.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"generator": {
|
||||
"description": "The options for the module generator.",
|
||||
"type": "object"
|
||||
|
|
|
@ -1753,19 +1753,6 @@ Object {
|
|||
"multiple": false,
|
||||
"simpleType": "string",
|
||||
},
|
||||
"module-parser-javascript-auto-extract-source-map": Object {
|
||||
"configs": Array [
|
||||
Object {
|
||||
"description": "Enable/Disable extracting source map.",
|
||||
"multiple": false,
|
||||
"path": "module.parser.javascript/auto.extractSourceMap",
|
||||
"type": "boolean",
|
||||
},
|
||||
],
|
||||
"description": "Enable/Disable extracting source map.",
|
||||
"multiple": false,
|
||||
"simpleType": "boolean",
|
||||
},
|
||||
"module-parser-javascript-auto-harmony": Object {
|
||||
"configs": Array [
|
||||
Object {
|
||||
|
@ -2459,19 +2446,6 @@ Object {
|
|||
"multiple": false,
|
||||
"simpleType": "string",
|
||||
},
|
||||
"module-parser-javascript-dynamic-extract-source-map": Object {
|
||||
"configs": Array [
|
||||
Object {
|
||||
"description": "Enable/Disable extracting source map.",
|
||||
"multiple": false,
|
||||
"path": "module.parser.javascript/dynamic.extractSourceMap",
|
||||
"type": "boolean",
|
||||
},
|
||||
],
|
||||
"description": "Enable/Disable extracting source map.",
|
||||
"multiple": false,
|
||||
"simpleType": "boolean",
|
||||
},
|
||||
"module-parser-javascript-dynamic-harmony": Object {
|
||||
"configs": Array [
|
||||
Object {
|
||||
|
@ -3183,19 +3157,6 @@ Object {
|
|||
"multiple": false,
|
||||
"simpleType": "string",
|
||||
},
|
||||
"module-parser-javascript-esm-extract-source-map": Object {
|
||||
"configs": Array [
|
||||
Object {
|
||||
"description": "Enable/Disable extracting source map.",
|
||||
"multiple": false,
|
||||
"path": "module.parser.javascript/esm.extractSourceMap",
|
||||
"type": "boolean",
|
||||
},
|
||||
],
|
||||
"description": "Enable/Disable extracting source map.",
|
||||
"multiple": false,
|
||||
"simpleType": "boolean",
|
||||
},
|
||||
"module-parser-javascript-esm-harmony": Object {
|
||||
"configs": Array [
|
||||
Object {
|
||||
|
@ -3681,19 +3642,6 @@ Object {
|
|||
"multiple": false,
|
||||
"simpleType": "string",
|
||||
},
|
||||
"module-parser-javascript-extract-source-map": Object {
|
||||
"configs": Array [
|
||||
Object {
|
||||
"description": "Enable/Disable extracting source map.",
|
||||
"multiple": false,
|
||||
"path": "module.parser.javascript.extractSourceMap",
|
||||
"type": "boolean",
|
||||
},
|
||||
],
|
||||
"description": "Enable/Disable extracting source map.",
|
||||
"multiple": false,
|
||||
"simpleType": "boolean",
|
||||
},
|
||||
"module-parser-javascript-harmony": Object {
|
||||
"configs": Array [
|
||||
Object {
|
||||
|
@ -4233,6 +4181,19 @@ Object {
|
|||
"multiple": true,
|
||||
"simpleType": "string",
|
||||
},
|
||||
"module-rules-extract-source-map": Object {
|
||||
"configs": Array [
|
||||
Object {
|
||||
"description": "Enable/Disable extracting source map.",
|
||||
"multiple": true,
|
||||
"path": "module.rules[].extractSourceMap",
|
||||
"type": "boolean",
|
||||
},
|
||||
],
|
||||
"description": "Enable/Disable extracting source map.",
|
||||
"multiple": true,
|
||||
"simpleType": "boolean",
|
||||
},
|
||||
"module-rules-include": Object {
|
||||
"configs": Array [
|
||||
Object {
|
||||
|
|
|
@ -7,9 +7,7 @@ module.exports = [
|
|||
module: {
|
||||
rules: [
|
||||
{
|
||||
parser: {
|
||||
extractSourceMap: true
|
||||
}
|
||||
extractSourceMap: true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -21,9 +19,7 @@ module.exports = [
|
|||
module: {
|
||||
rules: [
|
||||
{
|
||||
parser: {
|
||||
extractSourceMap: true
|
||||
}
|
||||
extractSourceMap: true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -35,9 +31,7 @@ module.exports = [
|
|||
module: {
|
||||
rules: [
|
||||
{
|
||||
parser: {
|
||||
extractSourceMap: true
|
||||
}
|
||||
extractSourceMap: true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -48,9 +42,7 @@ module.exports = [
|
|||
module: {
|
||||
rules: [
|
||||
{
|
||||
parser: {
|
||||
extractSourceMap: true
|
||||
}
|
||||
extractSourceMap: true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -6,9 +6,7 @@ module.exports = {
|
|||
module: {
|
||||
rules: [
|
||||
{
|
||||
parser: {
|
||||
extractSourceMap: true
|
||||
}
|
||||
extractSourceMap: true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -6344,11 +6344,6 @@ declare interface JavascriptParserOptions {
|
|||
*/
|
||||
exprContextRequest?: string;
|
||||
|
||||
/**
|
||||
* Enable/Disable extracting source map.
|
||||
*/
|
||||
extractSourceMap?: boolean;
|
||||
|
||||
/**
|
||||
* Enable/disable parsing of EcmaScript Modules syntax.
|
||||
*/
|
||||
|
@ -7588,7 +7583,12 @@ declare interface MinChunkSizePluginOptions {
|
|||
minChunkSize: number;
|
||||
}
|
||||
declare class Module extends DependenciesBlock {
|
||||
constructor(type: string, context?: null | string, layer?: null | string);
|
||||
constructor(
|
||||
type: string,
|
||||
context?: null | string,
|
||||
layer?: null | string,
|
||||
extractSourceMap?: boolean
|
||||
);
|
||||
type: string;
|
||||
context: null | string;
|
||||
layer: null | string;
|
||||
|
@ -7598,6 +7598,7 @@ declare class Module extends DependenciesBlock {
|
|||
factoryMeta?: FactoryMeta;
|
||||
useSourceMap: boolean;
|
||||
useSimpleSourceMap: boolean;
|
||||
extractSourceMap: boolean;
|
||||
buildMeta?: BuildMeta;
|
||||
buildInfo?: BuildInfo;
|
||||
presentationalDependencies?: Dependency[];
|
||||
|
@ -8234,6 +8235,11 @@ declare interface ModuleSettings {
|
|||
*/
|
||||
generator?: { [index: string]: any };
|
||||
|
||||
/**
|
||||
* Enable/Disable extracting source map.
|
||||
*/
|
||||
extractSourceMap?: boolean;
|
||||
|
||||
/**
|
||||
* Flags a module as with or without side effects.
|
||||
*/
|
||||
|
@ -8500,6 +8506,11 @@ declare interface NormalModuleCreateData {
|
|||
*/
|
||||
type: "" | "javascript/auto" | "javascript/dynamic" | "javascript/esm";
|
||||
|
||||
/**
|
||||
* should try to extract source map
|
||||
*/
|
||||
extractSourceMap?: boolean;
|
||||
|
||||
/**
|
||||
* request string
|
||||
*/
|
||||
|
@ -10959,6 +10970,11 @@ declare interface RuleSetRule {
|
|||
| RuleSetLogicalConditionsAbsolute
|
||||
| RuleSetConditionAbsolute[];
|
||||
|
||||
/**
|
||||
* Enable/Disable extracting source map.
|
||||
*/
|
||||
extractSourceMap?: boolean;
|
||||
|
||||
/**
|
||||
* The options for the module generator.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue