Merge pull request #12278 from xtuc/sven/import-assertions
parse import assertions
This commit is contained in:
commit
df02bc6c0a
|
@ -371,6 +371,13 @@ declare module "browserslist" {
|
|||
export = browserslist;
|
||||
}
|
||||
|
||||
// TODO remove that when @types/estree is updated
|
||||
interface ImportAttributeNode {
|
||||
type: "ImportAttribute";
|
||||
key: import("estree").Identifier | import("estree").Literal;
|
||||
value: import("estree").Literal;
|
||||
}
|
||||
|
||||
type TODO = any;
|
||||
|
||||
type RecursiveArrayOrRecord<T> =
|
||||
|
|
|
@ -1316,6 +1316,12 @@ export interface ModuleOptions {
|
|||
* A rule description with conditions and effects for modules.
|
||||
*/
|
||||
export interface RuleSetRule {
|
||||
/**
|
||||
* Match on import assertions of the dependency.
|
||||
*/
|
||||
assert?: {
|
||||
[k: string]: RuleSetConditionOrConditions;
|
||||
};
|
||||
/**
|
||||
* Match the child compiler name.
|
||||
*/
|
||||
|
|
|
@ -293,9 +293,13 @@ class NormalModule extends Module {
|
|||
*/
|
||||
identifier() {
|
||||
if (this.layer === null) {
|
||||
return this.request;
|
||||
if (this.type === "javascript/auto") {
|
||||
return this.request;
|
||||
} else {
|
||||
return `${this.type}|${this.request}`;
|
||||
}
|
||||
} else {
|
||||
return `${this.request}|${this.layer}`;
|
||||
return `${this.type}|${this.request}|${this.layer}`;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ const ModuleGraph = require("./ModuleGraph");
|
|||
const NormalModule = require("./NormalModule");
|
||||
const BasicEffectRulePlugin = require("./rules/BasicEffectRulePlugin");
|
||||
const BasicMatcherRulePlugin = require("./rules/BasicMatcherRulePlugin");
|
||||
const DescriptionDataMatcherRulePlugin = require("./rules/DescriptionDataMatcherRulePlugin");
|
||||
const ObjectMatcherRulePlugin = require("./rules/ObjectMatcherRulePlugin");
|
||||
const RuleSetCompiler = require("./rules/RuleSetCompiler");
|
||||
const UseEffectRulePlugin = require("./rules/UseEffectRulePlugin");
|
||||
const LazySet = require("./util/LazySet");
|
||||
|
@ -44,6 +44,7 @@ const { parseResource } = require("./util/identifier");
|
|||
* @property {ModuleFactoryCreateData["resolveOptions"]} resolveOptions
|
||||
* @property {string} context
|
||||
* @property {string} request
|
||||
* @property {Record<string, any> | undefined} assertions
|
||||
* @property {ModuleDependency[]} dependencies
|
||||
* @property {Object} createData
|
||||
* @property {LazySet<string>} fileDependencies
|
||||
|
@ -182,7 +183,8 @@ const ruleSetCompiler = new RuleSetCompiler([
|
|||
new BasicMatcherRulePlugin("issuer"),
|
||||
new BasicMatcherRulePlugin("compiler"),
|
||||
new BasicMatcherRulePlugin("issuerLayer"),
|
||||
new DescriptionDataMatcherRulePlugin(),
|
||||
new ObjectMatcherRulePlugin("assert", "assertions"),
|
||||
new ObjectMatcherRulePlugin("descriptionData"),
|
||||
new BasicEffectRulePlugin("type"),
|
||||
new BasicEffectRulePlugin("sideEffects"),
|
||||
new BasicEffectRulePlugin("parser"),
|
||||
|
@ -339,6 +341,7 @@ class NormalModuleFactory extends ModuleFactory {
|
|||
context,
|
||||
dependencies,
|
||||
request,
|
||||
assertions,
|
||||
resolveOptions,
|
||||
fileDependencies,
|
||||
missingDependencies,
|
||||
|
@ -447,6 +450,7 @@ class NormalModuleFactory extends ModuleFactory {
|
|||
resourceQuery: resourceDataForRules.query,
|
||||
resourceFragment: resourceDataForRules.fragment,
|
||||
scheme,
|
||||
assertions,
|
||||
mimetype: matchResourceData ? "" : resourceData.data.mimetype || "",
|
||||
dependency: dependencyType,
|
||||
descriptionData: matchResourceData
|
||||
|
@ -694,6 +698,7 @@ class NormalModuleFactory extends ModuleFactory {
|
|||
const resolveOptions = data.resolveOptions || EMPTY_RESOLVE_OPTIONS;
|
||||
const dependency = dependencies[0];
|
||||
const request = dependency.request;
|
||||
const assertions = dependency.assertions;
|
||||
const contextInfo = data.contextInfo;
|
||||
const fileDependencies = new LazySet();
|
||||
const missingDependencies = new LazySet();
|
||||
|
@ -704,6 +709,7 @@ class NormalModuleFactory extends ModuleFactory {
|
|||
resolveOptions,
|
||||
context,
|
||||
request,
|
||||
assertions,
|
||||
dependencies,
|
||||
fileDependencies,
|
||||
missingDependencies,
|
||||
|
|
|
@ -482,18 +482,6 @@ const applyModuleDefaults = (
|
|||
or: ["text/javascript", "application/javascript"]
|
||||
},
|
||||
...esm
|
||||
},
|
||||
{
|
||||
dependency: "url",
|
||||
oneOf: [
|
||||
{
|
||||
scheme: /^data$/,
|
||||
type: "asset/inline"
|
||||
},
|
||||
{
|
||||
type: "asset/resource"
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
if (asyncWebAssembly) {
|
||||
|
@ -541,6 +529,24 @@ const applyModuleDefaults = (
|
|||
...wasm
|
||||
});
|
||||
}
|
||||
rules.push(
|
||||
{
|
||||
dependency: "url",
|
||||
oneOf: [
|
||||
{
|
||||
scheme: /^data$/,
|
||||
type: "asset/inline"
|
||||
},
|
||||
{
|
||||
type: "asset/resource"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
assert: { type: "json" },
|
||||
type: "json"
|
||||
}
|
||||
);
|
||||
return rules;
|
||||
});
|
||||
};
|
||||
|
|
|
@ -12,7 +12,8 @@ const HarmonyExportHeaderDependency = require("./HarmonyExportHeaderDependency")
|
|||
const HarmonyExportImportedSpecifierDependency = require("./HarmonyExportImportedSpecifierDependency");
|
||||
const HarmonyExportSpecifierDependency = require("./HarmonyExportSpecifierDependency");
|
||||
const {
|
||||
harmonySpecifierTag
|
||||
harmonySpecifierTag,
|
||||
getAssertions
|
||||
} = require("./HarmonyImportDependencyParserPlugin");
|
||||
const HarmonyImportSideEffectDependency = require("./HarmonyImportSideEffectDependency");
|
||||
|
||||
|
@ -48,7 +49,8 @@ module.exports = class HarmonyExportDependencyParserPlugin {
|
|||
parser.state.module.addPresentationalDependency(clearDep);
|
||||
const sideEffectDep = new HarmonyImportSideEffectDependency(
|
||||
source,
|
||||
parser.state.lastHarmonyImportOrder
|
||||
parser.state.lastHarmonyImportOrder,
|
||||
getAssertions(statement)
|
||||
);
|
||||
sideEffectDep.loc = Object.create(statement.loc);
|
||||
sideEffectDep.loc.index = -1;
|
||||
|
@ -127,7 +129,8 @@ module.exports = class HarmonyExportDependencyParserPlugin {
|
|||
harmonyNamedExports,
|
||||
null,
|
||||
this.strictExportPresence,
|
||||
null
|
||||
null,
|
||||
settings.assertions
|
||||
);
|
||||
} else {
|
||||
dep = new HarmonyExportSpecifierDependency(id, name);
|
||||
|
|
|
@ -159,6 +159,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
|
|||
* @param {ReadonlyArray<HarmonyExportImportedSpecifierDependency> | Iterable<HarmonyExportImportedSpecifierDependency>} otherStarExports other star exports in the module before this import
|
||||
* @param {boolean} strictExportPresence when true, missing exports in the imported module lead to errors instead of warnings
|
||||
* @param {HarmonyStarExportsList} allStarExports all star exports in the module
|
||||
* @param {Record<string, any>=} assertions import assertions
|
||||
*/
|
||||
constructor(
|
||||
request,
|
||||
|
@ -168,9 +169,10 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
|
|||
activeExports,
|
||||
otherStarExports,
|
||||
strictExportPresence,
|
||||
allStarExports
|
||||
allStarExports,
|
||||
assertions
|
||||
) {
|
||||
super(request, sourceOrder);
|
||||
super(request, sourceOrder, assertions);
|
||||
|
||||
this.ids = ids;
|
||||
this.name = name;
|
||||
|
|
|
@ -32,10 +32,12 @@ class HarmonyImportDependency extends ModuleDependency {
|
|||
*
|
||||
* @param {string} request request string
|
||||
* @param {number} sourceOrder source order
|
||||
* @param {Record<string, any>=} assertions import assertions
|
||||
*/
|
||||
constructor(request, sourceOrder) {
|
||||
constructor(request, sourceOrder, assertions) {
|
||||
super(request);
|
||||
this.sourceOrder = sourceOrder;
|
||||
this.assertions = assertions;
|
||||
}
|
||||
|
||||
get category() {
|
||||
|
@ -201,12 +203,14 @@ class HarmonyImportDependency extends ModuleDependency {
|
|||
serialize(context) {
|
||||
const { write } = context;
|
||||
write(this.sourceOrder);
|
||||
write(this.assertions);
|
||||
super.serialize(context);
|
||||
}
|
||||
|
||||
deserialize(context) {
|
||||
const { read } = context;
|
||||
this.sourceOrder = read();
|
||||
this.assertions = read();
|
||||
super.deserialize(context);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,11 @@ const HarmonyExports = require("./HarmonyExports");
|
|||
const HarmonyImportSideEffectDependency = require("./HarmonyImportSideEffectDependency");
|
||||
const HarmonyImportSpecifierDependency = require("./HarmonyImportSpecifierDependency");
|
||||
|
||||
/** @typedef {import("estree").ExportAllDeclaration} ExportAllDeclaration */
|
||||
/** @typedef {import("estree").ExportNamedDeclaration} ExportNamedDeclaration */
|
||||
/** @typedef {import("estree").Identifier} Identifier */
|
||||
/** @typedef {import("estree").ImportDeclaration} ImportDeclaration */
|
||||
/** @typedef {import("estree").ImportExpression} ImportExpression */
|
||||
/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */
|
||||
/** @typedef {import("../optimize/InnerGraph").InnerGraph} InnerGraph */
|
||||
/** @typedef {import("../optimize/InnerGraph").TopLevelSymbol} TopLevelSymbol */
|
||||
|
@ -29,8 +33,32 @@ const harmonySpecifierTag = Symbol("harmony import");
|
|||
* @property {number} sourceOrder
|
||||
* @property {string} name
|
||||
* @property {boolean} await
|
||||
* @property {Record<string, any> | undefined} assertions
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {ImportDeclaration | ExportNamedDeclaration | ExportAllDeclaration | ImportExpression} node node with assertions
|
||||
* @returns {Record<string, any> | undefined} assertions
|
||||
*/
|
||||
function getAssertions(node) {
|
||||
// TODO remove cast when @types/estree has been updated to import assertions
|
||||
const assertions = /** @type {{ assertions?: ImportAttributeNode[] }} */ (
|
||||
node
|
||||
).assertions;
|
||||
if (assertions === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
const result = {};
|
||||
for (const assertion of assertions) {
|
||||
const key =
|
||||
assertion.key.type === "Identifier"
|
||||
? assertion.key.name
|
||||
: assertion.key.value;
|
||||
result[key] = assertion.value.value;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
module.exports = class HarmonyImportDependencyParserPlugin {
|
||||
constructor(options) {
|
||||
this.strictExportPresence = options.strictExportPresence;
|
||||
|
@ -65,9 +93,11 @@ module.exports = class HarmonyImportDependencyParserPlugin {
|
|||
clearDep.loc = statement.loc;
|
||||
parser.state.module.addPresentationalDependency(clearDep);
|
||||
parser.unsetAsiPosition(statement.range[1]);
|
||||
const assertions = getAssertions(statement);
|
||||
const sideEffectDep = new HarmonyImportSideEffectDependency(
|
||||
source,
|
||||
parser.state.lastHarmonyImportOrder
|
||||
parser.state.lastHarmonyImportOrder,
|
||||
assertions
|
||||
);
|
||||
sideEffectDep.loc = statement.loc;
|
||||
parser.state.module.addDependency(sideEffectDep);
|
||||
|
@ -82,7 +112,8 @@ module.exports = class HarmonyImportDependencyParserPlugin {
|
|||
name,
|
||||
source,
|
||||
ids,
|
||||
sourceOrder: parser.state.lastHarmonyImportOrder
|
||||
sourceOrder: parser.state.lastHarmonyImportOrder,
|
||||
assertions: getAssertions(statement)
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
@ -97,7 +128,8 @@ module.exports = class HarmonyImportDependencyParserPlugin {
|
|||
settings.ids,
|
||||
settings.name,
|
||||
expr.range,
|
||||
this.strictExportPresence
|
||||
this.strictExportPresence,
|
||||
settings.assertions
|
||||
);
|
||||
dep.shorthand = parser.scope.inShorthand;
|
||||
dep.directImport = true;
|
||||
|
@ -118,7 +150,8 @@ module.exports = class HarmonyImportDependencyParserPlugin {
|
|||
ids,
|
||||
settings.name,
|
||||
expr.range,
|
||||
this.strictExportPresence
|
||||
this.strictExportPresence,
|
||||
settings.assertions
|
||||
);
|
||||
dep.asiSafe = !parser.isAsiPosition(expr.range[0]);
|
||||
dep.loc = expr.loc;
|
||||
|
@ -138,7 +171,8 @@ module.exports = class HarmonyImportDependencyParserPlugin {
|
|||
ids,
|
||||
settings.name,
|
||||
callee.range,
|
||||
this.strictExportPresence
|
||||
this.strictExportPresence,
|
||||
settings.assertions
|
||||
);
|
||||
dep.directImport = members.length === 0;
|
||||
dep.call = true;
|
||||
|
@ -206,3 +240,4 @@ module.exports = class HarmonyImportDependencyParserPlugin {
|
|||
};
|
||||
|
||||
module.exports.harmonySpecifierTag = harmonySpecifierTag;
|
||||
module.exports.getAssertions = getAssertions;
|
||||
|
|
|
@ -20,8 +20,8 @@ const HarmonyImportDependency = require("./HarmonyImportDependency");
|
|||
/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */
|
||||
|
||||
class HarmonyImportSideEffectDependency extends HarmonyImportDependency {
|
||||
constructor(request, sourceOrder) {
|
||||
super(request, sourceOrder);
|
||||
constructor(request, sourceOrder, assertions) {
|
||||
super(request, sourceOrder, assertions);
|
||||
}
|
||||
|
||||
get type() {
|
||||
|
|
|
@ -29,8 +29,16 @@ const HarmonyImportDependency = require("./HarmonyImportDependency");
|
|||
const idsSymbol = Symbol("HarmonyImportSpecifierDependency.ids");
|
||||
|
||||
class HarmonyImportSpecifierDependency extends HarmonyImportDependency {
|
||||
constructor(request, sourceOrder, ids, name, range, strictExportPresence) {
|
||||
super(request, sourceOrder);
|
||||
constructor(
|
||||
request,
|
||||
sourceOrder,
|
||||
ids,
|
||||
name,
|
||||
range,
|
||||
strictExportPresence,
|
||||
assertions
|
||||
) {
|
||||
super(request, sourceOrder, assertions);
|
||||
this.ids = ids;
|
||||
this.name = name;
|
||||
this.range = range;
|
||||
|
|
|
@ -22,13 +22,20 @@ class ModuleDependency extends Dependency {
|
|||
this.request = request;
|
||||
this.userRequest = request;
|
||||
this.range = undefined;
|
||||
// assertions must be serialized by subclasses that use it
|
||||
/** @type {Record<string, any> | undefined} */
|
||||
this.assertions = undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {string | null} an identifier to merge equal requests
|
||||
*/
|
||||
getResourceIdentifier() {
|
||||
return `module${this.request}`;
|
||||
let str = `module${this.request}`;
|
||||
if (this.assertions !== undefined) {
|
||||
str += JSON.stringify(this.assertions);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
"use strict";
|
||||
|
||||
const { Parser: AcornParser } = require("acorn");
|
||||
const { importAssertions } = require("acorn-import-assertions");
|
||||
const { SyncBailHook, HookMap } = require("tapable");
|
||||
const vm = require("vm");
|
||||
const Parser = require("../Parser");
|
||||
|
@ -42,6 +43,10 @@ const BasicEvaluatedExpression = require("./BasicEvaluatedExpression");
|
|||
/** @typedef {import("estree").Node} AnyNode */
|
||||
/** @typedef {import("estree").Program} ProgramNode */
|
||||
/** @typedef {import("estree").Statement} StatementNode */
|
||||
/** @typedef {import("estree").ImportDeclaration} ImportDeclarationNode */
|
||||
/** @typedef {import("estree").ExportNamedDeclaration} ExportNamedDeclarationNode */
|
||||
/** @typedef {import("estree").ExportDefaultDeclaration} ExportDefaultDeclarationNode */
|
||||
/** @typedef {import("estree").ExportAllDeclaration} ExportAllDeclarationNode */
|
||||
/** @typedef {import("estree").Super} SuperNode */
|
||||
/** @typedef {import("estree").TaggedTemplateExpression} TaggedTemplateExpressionNode */
|
||||
/** @typedef {import("estree").TemplateLiteral} TemplateLiteralNode */
|
||||
|
@ -61,7 +66,7 @@ const ALLOWED_MEMBER_TYPES_ALL = 0b11;
|
|||
|
||||
// Syntax: https://developer.mozilla.org/en/SpiderMonkey/Parser_API
|
||||
|
||||
const parser = AcornParser;
|
||||
const parser = AcornParser.extend(importAssertions);
|
||||
|
||||
class VariableInfo {
|
||||
/**
|
||||
|
@ -190,31 +195,31 @@ class JavascriptParser extends Parser {
|
|||
]),
|
||||
/** @type {HookMap<SyncBailHook<[LabeledStatementNode], boolean | void>>} */
|
||||
label: new HookMap(() => new SyncBailHook(["statement"])),
|
||||
/** @type {SyncBailHook<[StatementNode, ImportSource], boolean | void>} */
|
||||
/** @type {SyncBailHook<[ImportDeclarationNode, ImportSource], boolean | void>} */
|
||||
import: new SyncBailHook(["statement", "source"]),
|
||||
/** @type {SyncBailHook<[StatementNode, ImportSource, string, string], boolean | void>} */
|
||||
/** @type {SyncBailHook<[ImportDeclarationNode, ImportSource, string, string], boolean | void>} */
|
||||
importSpecifier: new SyncBailHook([
|
||||
"statement",
|
||||
"source",
|
||||
"exportName",
|
||||
"identifierName"
|
||||
]),
|
||||
/** @type {SyncBailHook<[StatementNode], boolean | void>} */
|
||||
/** @type {SyncBailHook<[ExportNamedDeclarationNode | ExportAllDeclarationNode], boolean | void>} */
|
||||
export: new SyncBailHook(["statement"]),
|
||||
/** @type {SyncBailHook<[StatementNode, ImportSource], boolean | void>} */
|
||||
/** @type {SyncBailHook<[ExportNamedDeclarationNode | ExportAllDeclarationNode, ImportSource], boolean | void>} */
|
||||
exportImport: new SyncBailHook(["statement", "source"]),
|
||||
/** @type {SyncBailHook<[StatementNode, DeclarationNode], boolean | void>} */
|
||||
/** @type {SyncBailHook<[ExportNamedDeclarationNode | ExportAllDeclarationNode, DeclarationNode], boolean | void>} */
|
||||
exportDeclaration: new SyncBailHook(["statement", "declaration"]),
|
||||
/** @type {SyncBailHook<[StatementNode, DeclarationNode], boolean | void>} */
|
||||
/** @type {SyncBailHook<[ExportDefaultDeclarationNode, DeclarationNode], boolean | void>} */
|
||||
exportExpression: new SyncBailHook(["statement", "declaration"]),
|
||||
/** @type {SyncBailHook<[StatementNode, string, string, number | undefined], boolean | void>} */
|
||||
/** @type {SyncBailHook<[ExportNamedDeclarationNode | ExportAllDeclarationNode, string, string, number | undefined], boolean | void>} */
|
||||
exportSpecifier: new SyncBailHook([
|
||||
"statement",
|
||||
"identifierName",
|
||||
"exportName",
|
||||
"index"
|
||||
]),
|
||||
/** @type {SyncBailHook<[StatementNode, ImportSource, string, string, number | undefined], boolean | void>} */
|
||||
/** @type {SyncBailHook<[ExportNamedDeclarationNode | ExportAllDeclarationNode, ImportSource, string, string, number | undefined], boolean | void>} */
|
||||
exportImportSpecifier: new SyncBailHook([
|
||||
"statement",
|
||||
"source",
|
||||
|
|
|
@ -8,28 +8,32 @@
|
|||
/** @typedef {import("./RuleSetCompiler")} RuleSetCompiler */
|
||||
/** @typedef {import("./RuleSetCompiler").RuleCondition} RuleCondition */
|
||||
|
||||
const RULE_PROPERTY = "descriptionData";
|
||||
class ObjectMatcherRulePlugin {
|
||||
constructor(ruleProperty, dataProperty) {
|
||||
this.ruleProperty = ruleProperty;
|
||||
this.dataProperty = dataProperty || ruleProperty;
|
||||
}
|
||||
|
||||
class DescriptionDataMatcherRulePlugin {
|
||||
/**
|
||||
* @param {RuleSetCompiler} ruleSetCompiler the rule set compiler
|
||||
* @returns {void}
|
||||
*/
|
||||
apply(ruleSetCompiler) {
|
||||
const { ruleProperty, dataProperty } = this;
|
||||
ruleSetCompiler.hooks.rule.tap(
|
||||
"DescriptionDataMatcherRulePlugin",
|
||||
"ObjectMatcherRulePlugin",
|
||||
(path, rule, unhandledProperties, result) => {
|
||||
if (unhandledProperties.has(RULE_PROPERTY)) {
|
||||
unhandledProperties.delete(RULE_PROPERTY);
|
||||
const value = rule[RULE_PROPERTY];
|
||||
if (unhandledProperties.has(ruleProperty)) {
|
||||
unhandledProperties.delete(ruleProperty);
|
||||
const value = rule[ruleProperty];
|
||||
for (const property of Object.keys(value)) {
|
||||
const dataProperty = property.split(".");
|
||||
const nestedDataProperties = property.split(".");
|
||||
const condition = ruleSetCompiler.compileCondition(
|
||||
`${path}.${RULE_PROPERTY}.${property}`,
|
||||
`${path}.${ruleProperty}.${property}`,
|
||||
value[property]
|
||||
);
|
||||
result.conditions.push({
|
||||
property: ["descriptionData", ...dataProperty],
|
||||
property: [dataProperty, ...nestedDataProperties],
|
||||
matchWhenEmpty: condition.matchWhenEmpty,
|
||||
fn: condition.fn
|
||||
});
|
||||
|
@ -40,4 +44,4 @@ class DescriptionDataMatcherRulePlugin {
|
|||
}
|
||||
}
|
||||
|
||||
module.exports = DescriptionDataMatcherRulePlugin;
|
||||
module.exports = ObjectMatcherRulePlugin;
|
|
@ -11,6 +11,7 @@
|
|||
"@webassemblyjs/wasm-edit": "1.11.1",
|
||||
"@webassemblyjs/wasm-parser": "1.11.1",
|
||||
"acorn": "^8.4.1",
|
||||
"acorn-import-assertions": "1.7.1",
|
||||
"browserslist": "^4.14.5",
|
||||
"chrome-trace-event": "^1.0.2",
|
||||
"enhanced-resolve": "^5.8.0",
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -3585,6 +3585,13 @@
|
|||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"assert": {
|
||||
"description": "Match on import assertions of the dependency.",
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"$ref": "#/definitions/RuleSetConditionOrConditions"
|
||||
}
|
||||
},
|
||||
"compiler": {
|
||||
"description": "Match the child compiler name.",
|
||||
"oneOf": [
|
||||
|
|
|
@ -191,6 +191,12 @@ describe("Defaults", () => {
|
|||
},
|
||||
],
|
||||
},
|
||||
Object {
|
||||
"assert": Object {
|
||||
"type": "json",
|
||||
},
|
||||
"type": "json",
|
||||
},
|
||||
],
|
||||
"generator": Object {},
|
||||
"noParse": undefined,
|
||||
|
@ -819,8 +825,6 @@ describe("Defaults", () => {
|
|||
- "syncWebAssembly": false,
|
||||
+ "syncWebAssembly": true,
|
||||
@@ ... @@
|
||||
+ },
|
||||
+ ],
|
||||
+ },
|
||||
+ Object {
|
||||
+ "rules": Array [
|
||||
|
@ -845,9 +849,9 @@ describe("Defaults", () => {
|
|||
+ },
|
||||
+ "resolve": Object {
|
||||
+ "fullySpecified": true,
|
||||
@@ ... @@
|
||||
+ },
|
||||
+ },
|
||||
@@ ... @@
|
||||
+ ],
|
||||
+ "type": "webassembly/sync",
|
||||
`)
|
||||
);
|
||||
|
@ -891,8 +895,6 @@ describe("Defaults", () => {
|
|||
- "asyncWebAssembly": false,
|
||||
+ "asyncWebAssembly": true,
|
||||
@@ ... @@
|
||||
+ },
|
||||
+ ],
|
||||
+ },
|
||||
+ Object {
|
||||
+ "rules": Array [
|
||||
|
@ -917,9 +919,9 @@ describe("Defaults", () => {
|
|||
+ },
|
||||
+ "resolve": Object {
|
||||
+ "fullySpecified": true,
|
||||
@@ ... @@
|
||||
+ },
|
||||
+ },
|
||||
@@ ... @@
|
||||
+ ],
|
||||
+ "type": "webassembly/async",
|
||||
`)
|
||||
);
|
||||
|
@ -938,8 +940,6 @@ describe("Defaults", () => {
|
|||
- "syncWebAssembly": false,
|
||||
+ "syncWebAssembly": true,
|
||||
@@ ... @@
|
||||
+ },
|
||||
+ ],
|
||||
+ },
|
||||
+ Object {
|
||||
+ "rules": Array [
|
||||
|
@ -954,7 +954,7 @@ describe("Defaults", () => {
|
|||
+ ],
|
||||
+ "test": /\\.wasm$/i,
|
||||
+ "type": "webassembly/async",
|
||||
@@ ... @@
|
||||
+ },
|
||||
+ Object {
|
||||
+ "mimetype": "application/wasm",
|
||||
+ "rules": Array [
|
||||
|
@ -966,7 +966,7 @@ describe("Defaults", () => {
|
|||
+ "fullySpecified": true,
|
||||
+ },
|
||||
+ },
|
||||
@@ ... @@
|
||||
+ ],
|
||||
+ "type": "webassembly/async",
|
||||
`)
|
||||
);
|
||||
|
|
|
@ -182,7 +182,7 @@ describe("Validation", () => {
|
|||
expect(msg).toMatchInlineSnapshot(`
|
||||
"Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
|
||||
- configuration.module.rules[0].oneOf[0] has an unknown property 'passer'. These properties are valid:
|
||||
object { compiler?, dependency?, descriptionData?, enforce?, exclude?, generator?, include?, issuer?, issuerLayer?, layer?, loader?, mimetype?, oneOf?, options?, parser?, realResource?, resolve?, resource?, resourceFragment?, resourceQuery?, rules?, scheme?, sideEffects?, test?, type?, use? }
|
||||
object { assert?, compiler?, dependency?, descriptionData?, enforce?, exclude?, generator?, include?, issuer?, issuerLayer?, layer?, loader?, mimetype?, oneOf?, options?, parser?, realResource?, resolve?, resource?, resourceFragment?, resourceQuery?, rules?, scheme?, sideEffects?, test?, type?, use? }
|
||||
-> A rule description with conditions and effects for modules."
|
||||
`)
|
||||
);
|
||||
|
|
|
@ -2441,15 +2441,15 @@ LOG from webpack.FileSystemInfo
|
|||
exports[`StatsTestCases should print correct stats for real-content-hash 1`] = `
|
||||
"a-normal:
|
||||
assets by path *.js 3.22 KiB
|
||||
asset 92b100c9dd880fb6fedd-92b100.js 2.7 KiB [emitted] [immutable] [minimized] (name: runtime)
|
||||
asset a639a9edc4557744bf94-a639a9.js 288 bytes [emitted] [immutable] [minimized] (name: lazy)
|
||||
asset e00b58ce2785691cd374-e00b58.js 225 bytes [emitted] [immutable] [minimized] (name: index)
|
||||
asset 10bfdcacb3051293cdb8-10bfdc.js 2.7 KiB [emitted] [immutable] [minimized] (name: runtime)
|
||||
asset dafabd2c0a256cd3ba09-dafabd.js 288 bytes [emitted] [immutable] [minimized] (name: lazy)
|
||||
asset 58b1760470afdc121e5b-58b176.js 225 bytes [emitted] [immutable] [minimized] (name: index)
|
||||
asset 666f2b8847021ccc7608-666f2b.js 21 bytes [emitted] [immutable] [minimized] (name: a, b)
|
||||
assets by chunk 20.4 KiB (auxiliary name: lazy)
|
||||
asset 89a353e9c515885abd8e.png 14.6 KiB [emitted] [immutable] [from: file.png] (auxiliary name: lazy)
|
||||
asset 7382fad5b015914e0811.jpg?query 5.89 KiB [cached] [immutable] [from: file.jpg?query] (auxiliary name: lazy)
|
||||
asset 7382fad5b015914e0811.jpg 5.89 KiB [emitted] [immutable] [from: file.jpg] (auxiliary name: index)
|
||||
Entrypoint index 2.92 KiB (5.89 KiB) = 92b100c9dd880fb6fedd-92b100.js 2.7 KiB e00b58ce2785691cd374-e00b58.js 225 bytes 1 auxiliary asset
|
||||
Entrypoint index 2.92 KiB (5.89 KiB) = 10bfdcacb3051293cdb8-10bfdc.js 2.7 KiB 58b1760470afdc121e5b-58b176.js 225 bytes 1 auxiliary asset
|
||||
Entrypoint a 21 bytes = 666f2b8847021ccc7608-666f2b.js
|
||||
Entrypoint b 21 bytes = 666f2b8847021ccc7608-666f2b.js
|
||||
runtime modules 7.19 KiB 9 modules
|
||||
|
@ -2468,15 +2468,15 @@ exports[`StatsTestCases should print correct stats for real-content-hash 1`] = `
|
|||
|
||||
b-normal:
|
||||
assets by path *.js 3.22 KiB
|
||||
asset b02624dcf8d618f12ba1-b02624.js 2.7 KiB [emitted] [immutable] [minimized] (name: runtime)
|
||||
asset a639a9edc4557744bf94-a639a9.js 288 bytes [emitted] [immutable] [minimized] (name: lazy)
|
||||
asset e00b58ce2785691cd374-e00b58.js 225 bytes [emitted] [immutable] [minimized] (name: index)
|
||||
asset 51a734c984da3108483e-51a734.js 2.7 KiB [emitted] [immutable] [minimized] (name: runtime)
|
||||
asset dafabd2c0a256cd3ba09-dafabd.js 288 bytes [emitted] [immutable] [minimized] (name: lazy)
|
||||
asset 58b1760470afdc121e5b-58b176.js 225 bytes [emitted] [immutable] [minimized] (name: index)
|
||||
asset 666f2b8847021ccc7608-666f2b.js 21 bytes [emitted] [immutable] [minimized] (name: a, b)
|
||||
assets by chunk 20.4 KiB (auxiliary name: lazy)
|
||||
asset 89a353e9c515885abd8e.png 14.6 KiB [emitted] [immutable] [from: file.png] (auxiliary name: lazy)
|
||||
asset 7382fad5b015914e0811.jpg?query 5.89 KiB [cached] [immutable] [from: file.jpg?query] (auxiliary name: lazy)
|
||||
asset 7382fad5b015914e0811.jpg 5.89 KiB [emitted] [immutable] [from: file.jpg] (auxiliary name: index)
|
||||
Entrypoint index 2.92 KiB (5.89 KiB) = b02624dcf8d618f12ba1-b02624.js 2.7 KiB e00b58ce2785691cd374-e00b58.js 225 bytes 1 auxiliary asset
|
||||
Entrypoint index 2.92 KiB (5.89 KiB) = 51a734c984da3108483e-51a734.js 2.7 KiB 58b1760470afdc121e5b-58b176.js 225 bytes 1 auxiliary asset
|
||||
Entrypoint a 21 bytes = 666f2b8847021ccc7608-666f2b.js
|
||||
Entrypoint b 21 bytes = 666f2b8847021ccc7608-666f2b.js
|
||||
runtime modules 7.19 KiB 9 modules
|
||||
|
@ -2495,19 +2495,19 @@ b-normal:
|
|||
|
||||
a-source-map:
|
||||
assets by path *.js 3.44 KiB
|
||||
asset 64f4e187a137fbe6d037-64f4e1.js 2.76 KiB [emitted] [immutable] [minimized] (name: runtime)
|
||||
sourceMap 64f4e187a137fbe6d037-64f4e1.js.map 14.2 KiB [emitted] [dev] (auxiliary name: runtime)
|
||||
asset 05c637d15dff2d0dc5fd-05c637.js 344 bytes [emitted] [immutable] [minimized] (name: lazy)
|
||||
sourceMap 05c637d15dff2d0dc5fd-05c637.js.map 399 bytes [emitted] [dev] (auxiliary name: lazy)
|
||||
asset c41aff3dd03dbe1d8aa3-c41aff.js 281 bytes [emitted] [immutable] [minimized] (name: index)
|
||||
sourceMap c41aff3dd03dbe1d8aa3-c41aff.js.map 366 bytes [emitted] [dev] (auxiliary name: index)
|
||||
asset 53b1502f730643477466-53b150.js 2.76 KiB [emitted] [immutable] [minimized] (name: runtime)
|
||||
sourceMap 53b1502f730643477466-53b150.js.map 14.2 KiB [emitted] [dev] (auxiliary name: runtime)
|
||||
asset 6a0b20739c3374bc8404-6a0b20.js 344 bytes [emitted] [immutable] [minimized] (name: lazy)
|
||||
sourceMap 6a0b20739c3374bc8404-6a0b20.js.map 401 bytes [emitted] [dev] (auxiliary name: lazy)
|
||||
asset 20918c3d6f37be1833a3-20918c.js 281 bytes [emitted] [immutable] [minimized] (name: index)
|
||||
sourceMap 20918c3d6f37be1833a3-20918c.js.map 366 bytes [emitted] [dev] (auxiliary name: index)
|
||||
asset 222c2acc68675174e6b2-222c2a.js 77 bytes [emitted] [immutable] [minimized] (name: a, b)
|
||||
sourceMap 222c2acc68675174e6b2-222c2a.js.map 254 bytes [emitted] [dev] (auxiliary name: a, b)
|
||||
assets by chunk 20.4 KiB (auxiliary name: lazy)
|
||||
asset 89a353e9c515885abd8e.png 14.6 KiB [emitted] [immutable] [from: file.png] (auxiliary name: lazy)
|
||||
asset 7382fad5b015914e0811.jpg?query 5.89 KiB [cached] [immutable] [from: file.jpg?query] (auxiliary name: lazy)
|
||||
asset 7382fad5b015914e0811.jpg 5.89 KiB [emitted] [immutable] [from: file.jpg] (auxiliary name: index)
|
||||
Entrypoint index 3.03 KiB (20.5 KiB) = 64f4e187a137fbe6d037-64f4e1.js 2.76 KiB c41aff3dd03dbe1d8aa3-c41aff.js 281 bytes 3 auxiliary assets
|
||||
Entrypoint index 3.03 KiB (20.5 KiB) = 53b1502f730643477466-53b150.js 2.76 KiB 20918c3d6f37be1833a3-20918c.js 281 bytes 3 auxiliary assets
|
||||
Entrypoint a 77 bytes (254 bytes) = 222c2acc68675174e6b2-222c2a.js 1 auxiliary asset
|
||||
Entrypoint b 77 bytes (254 bytes) = 222c2acc68675174e6b2-222c2a.js 1 auxiliary asset
|
||||
runtime modules 7.19 KiB 9 modules
|
||||
|
@ -2526,19 +2526,19 @@ a-source-map:
|
|||
|
||||
b-source-map:
|
||||
assets by path *.js 3.44 KiB
|
||||
asset 3e79f6f89bbfaf1c154c-3e79f6.js 2.76 KiB [emitted] [immutable] [minimized] (name: runtime)
|
||||
sourceMap 3e79f6f89bbfaf1c154c-3e79f6.js.map 14.2 KiB [emitted] [dev] (auxiliary name: runtime)
|
||||
asset 05c637d15dff2d0dc5fd-05c637.js 344 bytes [emitted] [immutable] [minimized] (name: lazy)
|
||||
sourceMap 05c637d15dff2d0dc5fd-05c637.js.map 395 bytes [emitted] [dev] (auxiliary name: lazy)
|
||||
asset c41aff3dd03dbe1d8aa3-c41aff.js 281 bytes [emitted] [immutable] [minimized] (name: index)
|
||||
sourceMap c41aff3dd03dbe1d8aa3-c41aff.js.map 323 bytes [emitted] [dev] (auxiliary name: index)
|
||||
asset 4421f63e38fac939b46f-4421f6.js 2.76 KiB [emitted] [immutable] [minimized] (name: runtime)
|
||||
sourceMap 4421f63e38fac939b46f-4421f6.js.map 14.2 KiB [emitted] [dev] (auxiliary name: runtime)
|
||||
asset 6a0b20739c3374bc8404-6a0b20.js 344 bytes [emitted] [immutable] [minimized] (name: lazy)
|
||||
sourceMap 6a0b20739c3374bc8404-6a0b20.js.map 397 bytes [emitted] [dev] (auxiliary name: lazy)
|
||||
asset 20918c3d6f37be1833a3-20918c.js 281 bytes [emitted] [immutable] [minimized] (name: index)
|
||||
sourceMap 20918c3d6f37be1833a3-20918c.js.map 323 bytes [emitted] [dev] (auxiliary name: index)
|
||||
asset 222c2acc68675174e6b2-222c2a.js 77 bytes [emitted] [immutable] [minimized] (name: a, b)
|
||||
sourceMap 222c2acc68675174e6b2-222c2a.js.map 254 bytes [emitted] [dev] (auxiliary name: a, b)
|
||||
assets by chunk 20.4 KiB (auxiliary name: lazy)
|
||||
asset 89a353e9c515885abd8e.png 14.6 KiB [emitted] [immutable] [from: file.png] (auxiliary name: lazy)
|
||||
asset 7382fad5b015914e0811.jpg?query 5.89 KiB [cached] [immutable] [from: file.jpg?query] (auxiliary name: lazy)
|
||||
asset 7382fad5b015914e0811.jpg 5.89 KiB [emitted] [immutable] [from: file.jpg] (auxiliary name: index)
|
||||
Entrypoint index 3.03 KiB (20.4 KiB) = 3e79f6f89bbfaf1c154c-3e79f6.js 2.76 KiB c41aff3dd03dbe1d8aa3-c41aff.js 281 bytes 3 auxiliary assets
|
||||
Entrypoint index 3.03 KiB (20.4 KiB) = 4421f63e38fac939b46f-4421f6.js 2.76 KiB 20918c3d6f37be1833a3-20918c.js 281 bytes 3 auxiliary assets
|
||||
Entrypoint a 77 bytes (254 bytes) = 222c2acc68675174e6b2-222c2a.js 1 auxiliary asset
|
||||
Entrypoint b 77 bytes (254 bytes) = 222c2acc68675174e6b2-222c2a.js 1 auxiliary asset
|
||||
runtime modules 7.19 KiB 9 modules
|
||||
|
@ -4382,34 +4382,36 @@ webpack x.x.x compiled with 1 warning in X ms"
|
|||
`;
|
||||
|
||||
exports[`StatsTestCases should print correct stats for wasm-explorer-examples-sync 1`] = `
|
||||
"assets by path *.js 21.5 KiB
|
||||
asset bundle.js 16.1 KiB [emitted] (name: main)
|
||||
asset 325.bundle.js 3.98 KiB [emitted]
|
||||
asset 780.bundle.js 571 bytes [emitted]
|
||||
"assets by path *.js 21.7 KiB
|
||||
asset bundle.js 16.3 KiB [emitted] (name: main)
|
||||
asset 325.bundle.js 3.81 KiB [emitted]
|
||||
asset 795.bundle.js 571 bytes [emitted]
|
||||
asset 526.bundle.js 366 bytes [emitted] (id hint: vendors)
|
||||
asset 230.bundle.js 243 bytes [emitted]
|
||||
asset 99.bundle.js 241 bytes [emitted]
|
||||
asset 189.bundle.js 243 bytes [emitted]
|
||||
asset 517.bundle.js 243 bytes [emitted]
|
||||
asset 20.bundle.js 241 bytes [emitted]
|
||||
assets by path *.wasm 1.37 KiB
|
||||
asset 4098dd6bcb43bd54baf6.module.wasm 531 bytes [emitted] [immutable]
|
||||
asset a0bbe50b118b7ff0648b.module.wasm 290 bytes [emitted] [immutable]
|
||||
asset 86fec7665231a0198df8.module.wasm 156 bytes [emitted] [immutable]
|
||||
asset 1da1d844c1509ed4d4c3.module.wasm 154 bytes [emitted] [immutable]
|
||||
asset 2be4d707a05b1f7313ca.module.wasm 154 bytes [emitted] [immutable]
|
||||
asset d1fdb94978c775bdc12a.module.wasm 120 bytes [emitted] [immutable]
|
||||
chunk (runtime: main) 99.bundle.js 50 bytes (javascript) 531 bytes (webassembly) [rendered]
|
||||
asset e3f145b183228cc640d7.module.wasm 531 bytes [emitted] [immutable]
|
||||
asset 82d524821ee70d495948.module.wasm 290 bytes [emitted] [immutable]
|
||||
asset ea450800640f54975338.module.wasm 156 bytes [emitted] [immutable]
|
||||
asset ebbf27083d239c1ad5e3.module.wasm 154 bytes [emitted] [immutable]
|
||||
asset ee97efb6a05a4e504238.module.wasm 154 bytes [emitted] [immutable]
|
||||
asset 0301cb3f9f4151b567f5.module.wasm 120 bytes [emitted] [immutable]
|
||||
chunk (runtime: main) 20.bundle.js 50 bytes (javascript) 531 bytes (webassembly) [rendered]
|
||||
./duff.wasm 50 bytes (javascript) 531 bytes (webassembly) [built] [code generated]
|
||||
chunk (runtime: main) bundle.js (main) 586 bytes (javascript) 9.18 KiB (runtime) [entry] [rendered]
|
||||
runtime modules 9.18 KiB 11 modules
|
||||
./index.js 586 bytes [built] [code generated]
|
||||
chunk (runtime: main) 230.bundle.js 50 bytes (javascript) 156 bytes (webassembly) [rendered]
|
||||
chunk (runtime: main) 189.bundle.js 50 bytes (javascript) 156 bytes (webassembly) [rendered]
|
||||
./Q_rsqrt.wasm 50 bytes (javascript) 156 bytes (webassembly) [built] [code generated]
|
||||
chunk (runtime: main) 325.bundle.js 1.5 KiB (javascript) 274 bytes (webassembly) [rendered]
|
||||
./popcnt.wasm 50 bytes (javascript) 120 bytes (webassembly) [dependent] [built] [code generated]
|
||||
chunk (runtime: main) 325.bundle.js 1.45 KiB (javascript) 154 bytes (webassembly) [rendered]
|
||||
./testFunction.wasm 50 bytes (javascript) 154 bytes (webassembly) [dependent] [built] [code generated]
|
||||
./tests.js 1.4 KiB [built] [code generated]
|
||||
chunk (runtime: main) 517.bundle.js 50 bytes (javascript) 120 bytes (webassembly) [rendered]
|
||||
./popcnt.wasm 50 bytes (javascript) 120 bytes (webassembly) [built] [code generated]
|
||||
chunk (runtime: main) 526.bundle.js (id hint: vendors) 34 bytes [rendered] split chunk (cache group: defaultVendors)
|
||||
./node_modules/env.js 34 bytes [built] [code generated]
|
||||
chunk (runtime: main) 780.bundle.js 110 bytes (javascript) 444 bytes (webassembly) [rendered]
|
||||
chunk (runtime: main) 795.bundle.js 110 bytes (javascript) 444 bytes (webassembly) [rendered]
|
||||
./fact.wasm 50 bytes (javascript) 154 bytes (webassembly) [built] [code generated]
|
||||
./fast-math.wasm 60 bytes (javascript) 290 bytes (webassembly) [built] [code generated]
|
||||
runtime modules 9.18 KiB 11 modules
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
throw new Error("imported")
|
|
@ -0,0 +1 @@
|
|||
[1, 2, 3, 4]
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = [
|
||||
[{ moduleName: /data.poison/, message: /Unexpected token .+ in JSON/ }]
|
||||
];
|
|
@ -0,0 +1,3 @@
|
|||
import poison from "../data/poison" assert { type: "json" };
|
||||
|
||||
export default poison;
|
|
@ -0,0 +1,21 @@
|
|||
import c from "../data/c.json" assert { type: "json" };
|
||||
import unknownJson from "../data/unknown" assert { type: "json" };
|
||||
import unknownJs from "../data/unknown";
|
||||
|
||||
it("should be possible to import json data with import assertion", function () {
|
||||
expect(c).toEqual([1, 2, 3, 4]);
|
||||
});
|
||||
|
||||
it("should be possible to import json data without extension with import assertion", function () {
|
||||
expect(unknownJson).toEqual([1, 2, 3, 4]);
|
||||
});
|
||||
|
||||
it("should be possible to import js without extension without import assertion in the same file", function () {
|
||||
expect(unknownJs).toEqual({});
|
||||
});
|
||||
|
||||
it("should not be possible to import js with import assertion", function () {
|
||||
expect(() => {
|
||||
require("./import-poison.js");
|
||||
}).toThrowError();
|
||||
});
|
|
@ -7,8 +7,8 @@ it("should generate the correct output files", () => {
|
|||
NORMAL1 && `634.bundle${INDEX}.js`,
|
||||
NORMAL2 && `882.bundle${INDEX}.js`,
|
||||
`bundle${INDEX}.js`,
|
||||
"localization-219.js",
|
||||
CONTENT2 && "localization-551.js",
|
||||
CONTENT2 && "localization-264.js",
|
||||
"localization-530.js",
|
||||
NORMAL1 && "localization-634.js",
|
||||
NORMAL2 && "localization-882.js"
|
||||
].filter(Boolean)
|
||||
|
|
|
@ -4735,21 +4735,44 @@ declare class JavascriptParser extends Parser {
|
|||
boolean | void
|
||||
>;
|
||||
label: HookMap<SyncBailHook<[LabeledStatement], boolean | void>>;
|
||||
import: SyncBailHook<[Statement, ImportSource], boolean | void>;
|
||||
import: SyncBailHook<[ImportDeclaration, ImportSource], boolean | void>;
|
||||
importSpecifier: SyncBailHook<
|
||||
[Statement, ImportSource, string, string],
|
||||
[ImportDeclaration, ImportSource, string, string],
|
||||
boolean | void
|
||||
>;
|
||||
export: SyncBailHook<
|
||||
[ExportNamedDeclaration | ExportAllDeclaration],
|
||||
boolean | void
|
||||
>;
|
||||
exportImport: SyncBailHook<
|
||||
[ExportNamedDeclaration | ExportAllDeclaration, ImportSource],
|
||||
boolean | void
|
||||
>;
|
||||
exportDeclaration: SyncBailHook<
|
||||
[ExportNamedDeclaration | ExportAllDeclaration, Declaration],
|
||||
boolean | void
|
||||
>;
|
||||
exportExpression: SyncBailHook<
|
||||
[ExportDefaultDeclaration, Declaration],
|
||||
boolean | void
|
||||
>;
|
||||
export: SyncBailHook<[Statement], boolean | void>;
|
||||
exportImport: SyncBailHook<[Statement, ImportSource], boolean | void>;
|
||||
exportDeclaration: SyncBailHook<[Statement, Declaration], boolean | void>;
|
||||
exportExpression: SyncBailHook<[Statement, Declaration], boolean | void>;
|
||||
exportSpecifier: SyncBailHook<
|
||||
[Statement, string, string, undefined | number],
|
||||
[
|
||||
ExportNamedDeclaration | ExportAllDeclaration,
|
||||
string,
|
||||
string,
|
||||
undefined | number
|
||||
],
|
||||
boolean | void
|
||||
>;
|
||||
exportImportSpecifier: SyncBailHook<
|
||||
[Statement, ImportSource, string, string, undefined | number],
|
||||
[
|
||||
ExportNamedDeclaration | ExportAllDeclaration,
|
||||
ImportSource,
|
||||
string,
|
||||
string,
|
||||
undefined | number
|
||||
],
|
||||
boolean | void
|
||||
>;
|
||||
preDeclarator: SyncBailHook<
|
||||
|
@ -6374,6 +6397,7 @@ declare class ModuleDependency extends Dependency {
|
|||
request: string;
|
||||
userRequest: string;
|
||||
range: any;
|
||||
assertions?: Record<string, any>;
|
||||
static Template: typeof DependencyTemplate;
|
||||
static NO_EXPORTS_REFERENCED: string[][];
|
||||
static EXPORTS_OBJECT_REFERENCED: string[][];
|
||||
|
@ -8930,6 +8954,7 @@ declare interface ResolveData {
|
|||
resolveOptions?: ResolveOptionsWebpackOptions;
|
||||
context: string;
|
||||
request: string;
|
||||
assertions?: Record<string, any>;
|
||||
dependencies: ModuleDependency[];
|
||||
createData: Object;
|
||||
fileDependencies: LazySet<string>;
|
||||
|
@ -9341,6 +9366,11 @@ declare interface RuleSetLogicalConditionsAbsolute {
|
|||
* A rule description with conditions and effects for modules.
|
||||
*/
|
||||
declare interface RuleSetRule {
|
||||
/**
|
||||
* Match on import assertions of the dependency.
|
||||
*/
|
||||
assert?: { [index: string]: RuleSetConditionOrConditions };
|
||||
|
||||
/**
|
||||
* Match the child compiler name.
|
||||
*/
|
||||
|
|
|
@ -1225,6 +1225,11 @@ acorn-globals@^6.0.0:
|
|||
acorn "^7.1.1"
|
||||
acorn-walk "^7.1.1"
|
||||
|
||||
acorn-import-assertions@1.7.1:
|
||||
version "1.7.1"
|
||||
resolved "https://registry.yarnpkg.com/acorn-import-assertions/-/acorn-import-assertions-1.7.1.tgz#da2c1fd00dbd7fd8b22c59957cea3e4508e64fa5"
|
||||
integrity sha512-Wc7PWe2G9s9E3aPaKDvOgV00xn1HIetG3VxPs+Jtr/4nHpdfLZ/0JbEVM83QCUqV4fYilbMb+y5SSXHMzP8AVw==
|
||||
|
||||
acorn-jsx@^5.3.1:
|
||||
version "5.3.1"
|
||||
resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.1.tgz#fc8661e11b7ac1539c47dbfea2e72b3af34d267b"
|
||||
|
|
Loading…
Reference in New Issue