mirror of https://github.com/webpack/webpack.git
refactor: use `eslint-config-webpack` (#19645)
Github Actions / lint (push) Waiting to run
Details
Github Actions / validate-legacy-node (push) Waiting to run
Details
Github Actions / benchmark (1/4) (push) Waiting to run
Details
Github Actions / benchmark (2/4) (push) Waiting to run
Details
Github Actions / benchmark (3/4) (push) Waiting to run
Details
Github Actions / benchmark (4/4) (push) Waiting to run
Details
Github Actions / basic (push) Waiting to run
Details
Github Actions / unit (push) Waiting to run
Details
Github Actions / integration (10.x, macos-latest, a) (push) Blocked by required conditions
Details
Github Actions / integration (10.x, macos-latest, b) (push) Blocked by required conditions
Details
Github Actions / integration (10.x, ubuntu-latest, a) (push) Blocked by required conditions
Details
Github Actions / integration (10.x, ubuntu-latest, b) (push) Blocked by required conditions
Details
Github Actions / integration (10.x, windows-latest, a) (push) Blocked by required conditions
Details
Github Actions / integration (10.x, windows-latest, b) (push) Blocked by required conditions
Details
Github Actions / integration (12.x, ubuntu-latest, a) (push) Blocked by required conditions
Details
Github Actions / integration (14.x, ubuntu-latest, a) (push) Blocked by required conditions
Details
Github Actions / integration (16.x, ubuntu-latest, a) (push) Blocked by required conditions
Details
Github Actions / integration (18.x, ubuntu-latest, a) (push) Blocked by required conditions
Details
Github Actions / integration (20.x, macos-latest, a) (push) Blocked by required conditions
Details
Github Actions / integration (20.x, macos-latest, b) (push) Blocked by required conditions
Details
Github Actions / integration (20.x, ubuntu-latest, a) (push) Blocked by required conditions
Details
Github Actions / integration (20.x, ubuntu-latest, b) (push) Blocked by required conditions
Details
Github Actions / integration (20.x, windows-latest, a) (push) Blocked by required conditions
Details
Github Actions / integration (20.x, windows-latest, b) (push) Blocked by required conditions
Details
Github Actions / integration (22.x, macos-latest, a) (push) Blocked by required conditions
Details
Github Actions / integration (22.x, macos-latest, b) (push) Blocked by required conditions
Details
Github Actions / integration (22.x, ubuntu-latest, a) (push) Blocked by required conditions
Details
Github Actions / integration (22.x, ubuntu-latest, b) (push) Blocked by required conditions
Details
Github Actions / integration (22.x, windows-latest, a) (push) Blocked by required conditions
Details
Github Actions / integration (22.x, windows-latest, b) (push) Blocked by required conditions
Details
Github Actions / integration (24.x, macos-latest, a) (push) Blocked by required conditions
Details
Github Actions / integration (24.x, macos-latest, b) (push) Blocked by required conditions
Details
Github Actions / integration (24.x, ubuntu-latest, a) (push) Blocked by required conditions
Details
Github Actions / integration (24.x, ubuntu-latest, b) (push) Blocked by required conditions
Details
Github Actions / integration (24.x, windows-latest, a) (push) Blocked by required conditions
Details
Github Actions / integration (24.x, windows-latest, b) (push) Blocked by required conditions
Details
Github Actions / integration (lts/*, ubuntu-latest, a, 1) (push) Blocked by required conditions
Details
Github Actions / integration (lts/*, ubuntu-latest, b, 1) (push) Blocked by required conditions
Details
Github Actions / lint (push) Waiting to run
Details
Github Actions / validate-legacy-node (push) Waiting to run
Details
Github Actions / benchmark (1/4) (push) Waiting to run
Details
Github Actions / benchmark (2/4) (push) Waiting to run
Details
Github Actions / benchmark (3/4) (push) Waiting to run
Details
Github Actions / benchmark (4/4) (push) Waiting to run
Details
Github Actions / basic (push) Waiting to run
Details
Github Actions / unit (push) Waiting to run
Details
Github Actions / integration (10.x, macos-latest, a) (push) Blocked by required conditions
Details
Github Actions / integration (10.x, macos-latest, b) (push) Blocked by required conditions
Details
Github Actions / integration (10.x, ubuntu-latest, a) (push) Blocked by required conditions
Details
Github Actions / integration (10.x, ubuntu-latest, b) (push) Blocked by required conditions
Details
Github Actions / integration (10.x, windows-latest, a) (push) Blocked by required conditions
Details
Github Actions / integration (10.x, windows-latest, b) (push) Blocked by required conditions
Details
Github Actions / integration (12.x, ubuntu-latest, a) (push) Blocked by required conditions
Details
Github Actions / integration (14.x, ubuntu-latest, a) (push) Blocked by required conditions
Details
Github Actions / integration (16.x, ubuntu-latest, a) (push) Blocked by required conditions
Details
Github Actions / integration (18.x, ubuntu-latest, a) (push) Blocked by required conditions
Details
Github Actions / integration (20.x, macos-latest, a) (push) Blocked by required conditions
Details
Github Actions / integration (20.x, macos-latest, b) (push) Blocked by required conditions
Details
Github Actions / integration (20.x, ubuntu-latest, a) (push) Blocked by required conditions
Details
Github Actions / integration (20.x, ubuntu-latest, b) (push) Blocked by required conditions
Details
Github Actions / integration (20.x, windows-latest, a) (push) Blocked by required conditions
Details
Github Actions / integration (20.x, windows-latest, b) (push) Blocked by required conditions
Details
Github Actions / integration (22.x, macos-latest, a) (push) Blocked by required conditions
Details
Github Actions / integration (22.x, macos-latest, b) (push) Blocked by required conditions
Details
Github Actions / integration (22.x, ubuntu-latest, a) (push) Blocked by required conditions
Details
Github Actions / integration (22.x, ubuntu-latest, b) (push) Blocked by required conditions
Details
Github Actions / integration (22.x, windows-latest, a) (push) Blocked by required conditions
Details
Github Actions / integration (22.x, windows-latest, b) (push) Blocked by required conditions
Details
Github Actions / integration (24.x, macos-latest, a) (push) Blocked by required conditions
Details
Github Actions / integration (24.x, macos-latest, b) (push) Blocked by required conditions
Details
Github Actions / integration (24.x, ubuntu-latest, a) (push) Blocked by required conditions
Details
Github Actions / integration (24.x, ubuntu-latest, b) (push) Blocked by required conditions
Details
Github Actions / integration (24.x, windows-latest, a) (push) Blocked by required conditions
Details
Github Actions / integration (24.x, windows-latest, b) (push) Blocked by required conditions
Details
Github Actions / integration (lts/*, ubuntu-latest, a, 1) (push) Blocked by required conditions
Details
Github Actions / integration (lts/*, ubuntu-latest, b, 1) (push) Blocked by required conditions
Details
This commit is contained in:
parent
cf1dc2f131
commit
02a1d22db8
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
printWidth: 80,
|
printWidth: 80,
|
||||||
useTabs: true,
|
useTabs: true,
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} command process to run
|
* @param {string} command process to run
|
||||||
* @param {string[]} args command line arguments
|
* @param {string[]} args command line arguments
|
||||||
|
@ -7,6 +9,7 @@
|
||||||
*/
|
*/
|
||||||
const runCommand = (command, args) => {
|
const runCommand = (command, args) => {
|
||||||
const cp = require("child_process");
|
const cp = require("child_process");
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const executedCommand = cp.spawn(command, args, {
|
const executedCommand = cp.spawn(command, args, {
|
||||||
stdio: "inherit",
|
stdio: "inherit",
|
||||||
|
@ -75,7 +78,9 @@ const isInstalled = packageName => {
|
||||||
*/
|
*/
|
||||||
const runCli = cli => {
|
const runCli = cli => {
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
|
||||||
const pkgPath = require.resolve(`${cli.package}/package.json`);
|
const pkgPath = require.resolve(`${cli.package}/package.json`);
|
||||||
|
|
||||||
const pkg = require(pkgPath);
|
const pkg = require(pkgPath);
|
||||||
|
|
||||||
if (pkg.type === "module" || /\.mjs/i.test(pkg.bin[cli.binName])) {
|
if (pkg.type === "module" || /\.mjs/i.test(pkg.bin[cli.binName])) {
|
||||||
|
|
|
@ -1,15 +1,7 @@
|
||||||
import { defineConfig, globalIgnores } from "eslint/config";
|
import { defineConfig, globalIgnores } from "eslint/config";
|
||||||
import js from "@eslint/js";
|
import config from "eslint-config-webpack";
|
||||||
import prettier from "eslint-plugin-prettier";
|
import configs from "eslint-config-webpack/configs.js";
|
||||||
import nodePlugin from "eslint-plugin-n";
|
|
||||||
import jest from "eslint-plugin-jest";
|
|
||||||
import jsdoc from "eslint-plugin-jsdoc";
|
|
||||||
import prettierConfig from "eslint-config-prettier";
|
|
||||||
import globals from "globals";
|
import globals from "globals";
|
||||||
import stylistic from "@stylistic/eslint-plugin";
|
|
||||||
import unicorn from "eslint-plugin-unicorn";
|
|
||||||
|
|
||||||
const jsdocConfig = jsdoc.configs["flat/recommended-typescript-flavor-error"];
|
|
||||||
|
|
||||||
export default defineConfig([
|
export default defineConfig([
|
||||||
globalIgnores([
|
globalIgnores([
|
||||||
|
@ -31,6 +23,10 @@ export default defineConfig([
|
||||||
"!test/_helpers/**/*.mjs",
|
"!test/_helpers/**/*.mjs",
|
||||||
"test/js/**/*.*",
|
"test/js/**/*.*",
|
||||||
|
|
||||||
|
// TODO fix me
|
||||||
|
// This is not exactly typescript
|
||||||
|
"assembly/**/*.ts",
|
||||||
|
|
||||||
// Ignore some folders
|
// Ignore some folders
|
||||||
"benchmark",
|
"benchmark",
|
||||||
"coverage",
|
"coverage",
|
||||||
|
@ -48,64 +44,35 @@ export default defineConfig([
|
||||||
"lib/util/semver.js",
|
"lib/util/semver.js",
|
||||||
|
|
||||||
// Ignore some examples files
|
// Ignore some examples files
|
||||||
"examples/**/*.js",
|
"examples/**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx,md}",
|
||||||
"examples/**/*.mjs",
|
|
||||||
"!examples/*/webpack.config.js"
|
"!examples/*/webpack.config.js"
|
||||||
]),
|
]),
|
||||||
{
|
{
|
||||||
files: ["**/*.mjs"],
|
ignores: ["lib/**/*.runtime.js", "hot/*.js"],
|
||||||
languageOptions: {
|
extends: [config],
|
||||||
sourceType: "module"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
files: ["**/*.{js,cjs}"],
|
|
||||||
languageOptions: {
|
|
||||||
ecmaVersion: 2018,
|
|
||||||
sourceType: "commonjs",
|
|
||||||
globals: {
|
|
||||||
...globals.node,
|
|
||||||
...globals.es2018,
|
|
||||||
WebAssembly: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
...nodePlugin.configs["flat/mixed-esm-and-cjs"],
|
|
||||||
{
|
|
||||||
plugins: {
|
|
||||||
n: nodePlugin
|
|
||||||
},
|
|
||||||
rules: {
|
rules: {
|
||||||
"n/no-missing-require": ["error", { allowModules: ["webpack"] }],
|
// Revisit it in future
|
||||||
"n/no-unsupported-features/node-builtins": [
|
"id-length": "off",
|
||||||
|
// Revisit it in future
|
||||||
|
"no-use-before-define": "off",
|
||||||
|
// We have helpers for the default configuration
|
||||||
|
"new-cap": [
|
||||||
"error",
|
"error",
|
||||||
{
|
{
|
||||||
ignores: [
|
newIsCapExceptions: [],
|
||||||
"zlib.createBrotliCompress",
|
capIsNewExceptions: ["A", "F", "D", "MODULES_GROUPERS"]
|
||||||
"zlib.createBrotliDecompress",
|
|
||||||
"EventSource"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"n/exports-style": "error"
|
|
||||||
}
|
// TODO enable me in future
|
||||||
},
|
"prefer-destructuring": "off",
|
||||||
{
|
// TODO enable me in future, we need to ignore Object.define
|
||||||
...js.configs.recommended,
|
"func-names": "off",
|
||||||
linterOptions: {
|
// TODO enable me in future
|
||||||
reportUnusedDisableDirectives: true
|
"unicorn/prefer-spread": "off",
|
||||||
},
|
// TODO need patch in tooling, now we are doing weird order for destructuring in cjs import
|
||||||
rules: {
|
"import/order": "off",
|
||||||
...js.configs.recommended.rules,
|
// TODO We need allow to have `_arg` in tooling and use `after-used` value for `args`
|
||||||
"no-template-curly-in-string": "error",
|
|
||||||
"no-caller": "error",
|
|
||||||
"no-control-regex": "off",
|
|
||||||
yoda: "error",
|
|
||||||
eqeqeq: "error",
|
|
||||||
"eol-last": "error",
|
|
||||||
"no-extra-bind": "warn",
|
|
||||||
"no-process-exit": "warn",
|
|
||||||
"no-use-before-define": "off",
|
|
||||||
"no-unused-vars": [
|
"no-unused-vars": [
|
||||||
"error",
|
"error",
|
||||||
{
|
{
|
||||||
|
@ -115,357 +82,28 @@ export default defineConfig([
|
||||||
argsIgnorePattern: "^_",
|
argsIgnorePattern: "^_",
|
||||||
caughtErrors: "all",
|
caughtErrors: "all",
|
||||||
caughtErrorsIgnorePattern: "^_",
|
caughtErrorsIgnorePattern: "^_",
|
||||||
ignoreRestSiblings: true
|
destructuredArrayIgnorePattern: "^_",
|
||||||
|
ignoreRestSiblings: true,
|
||||||
|
ignoreClassWithStaticInitBlock: false,
|
||||||
|
reportUsedIgnorePattern: false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"no-inner-declarations": "error",
|
|
||||||
"prefer-const": [
|
// Too noise
|
||||||
"error",
|
|
||||||
{
|
|
||||||
destructuring: "all",
|
|
||||||
ignoreReadBeforeAssign: true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"object-shorthand": "error",
|
|
||||||
"no-else-return": "error",
|
|
||||||
"no-lonely-if": "error",
|
|
||||||
"no-undef-init": "error",
|
|
||||||
// Disallow ts-ignore directive. Use ts-expect-error instead
|
|
||||||
"no-warning-comments": ["error", { terms: ["@ts-ignore"] }],
|
|
||||||
"no-constructor-return": "error",
|
|
||||||
"symbol-description": "error",
|
|
||||||
"array-callback-return": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
allowImplicit: true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"no-promise-executor-return": "error",
|
|
||||||
"no-undef": "error",
|
|
||||||
"guard-for-in": "error",
|
|
||||||
"no-constant-condition": "error",
|
|
||||||
camelcase: [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
allow: [
|
|
||||||
"__webpack_require__",
|
|
||||||
"__webpack_public_path__",
|
|
||||||
"__webpack_base_uri__",
|
|
||||||
"__webpack_modules__",
|
|
||||||
"__webpack_chunk_load__",
|
|
||||||
"__non_webpack_require__",
|
|
||||||
"__webpack_nonce__",
|
|
||||||
"__webpack_hash__",
|
|
||||||
"__webpack_chunkname__",
|
|
||||||
"__webpack_get_script_filename__",
|
|
||||||
"__webpack_runtime_id__",
|
|
||||||
"__system_context__",
|
|
||||||
"__webpack_share_scopes__",
|
|
||||||
"__webpack_init_sharing__",
|
|
||||||
"__webpack_require_module__",
|
|
||||||
"_stream_duplex",
|
|
||||||
"_stream_passthrough",
|
|
||||||
"_stream_readable",
|
|
||||||
"_stream_transform",
|
|
||||||
"_stream_writable",
|
|
||||||
"string_decoder"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"prefer-exponentiation-operator": "error",
|
|
||||||
"no-useless-return": "error",
|
|
||||||
"no-return-assign": "error",
|
|
||||||
"default-case-last": "error",
|
|
||||||
"default-param-last": "error",
|
|
||||||
"dot-notation": "error",
|
|
||||||
"grouped-accessor-pairs": "error",
|
|
||||||
"id-match": [
|
|
||||||
"error",
|
|
||||||
"^[$a-zA-Z_][$a-zA-Z0-9_]*$",
|
|
||||||
{
|
|
||||||
properties: true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"no-console": "error",
|
|
||||||
"no-extra-label": "error",
|
|
||||||
"no-label-var": "error",
|
|
||||||
"no-lone-blocks": "error",
|
|
||||||
"no-multi-str": "error",
|
|
||||||
"no-new-func": "error",
|
|
||||||
"no-unneeded-ternary": ["error", { defaultAssignment: false }],
|
|
||||||
"no-useless-call": "error",
|
|
||||||
"no-useless-concat": "error",
|
|
||||||
"prefer-object-spread": "error",
|
|
||||||
"prefer-regex-literals": "error",
|
|
||||||
"prefer-rest-params": "error",
|
|
||||||
"no-var": "error",
|
|
||||||
"one-var": ["error", "never"],
|
|
||||||
"prefer-template": "error",
|
|
||||||
"no-implicit-coercion": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
boolean: true,
|
|
||||||
number: true,
|
|
||||||
string: true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"arrow-body-style": ["error", "as-needed"],
|
|
||||||
"new-cap": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
newIsCapExceptions: [],
|
|
||||||
capIsNewExceptions: ["A", "F", "D", "MODULES_GROUPERS"]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"func-style": [
|
|
||||||
"error",
|
|
||||||
"declaration",
|
|
||||||
{
|
|
||||||
allowArrowFunctions: true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"no-loop-func": "error",
|
|
||||||
"no-unreachable-loop": "error",
|
|
||||||
"no-unmodified-loop-condition": "error",
|
|
||||||
"prefer-spread": "error",
|
|
||||||
"no-sequences": "error",
|
|
||||||
// TODO Enable
|
|
||||||
"id-length": "off",
|
|
||||||
"prefer-destructuring": "off"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
plugins: {
|
|
||||||
unicorn
|
|
||||||
},
|
|
||||||
rules: {
|
|
||||||
"unicorn/catch-error-name": [
|
|
||||||
"error",
|
|
||||||
{ name: "err", ignore: [/(^_|[0-9]+$)/i] }
|
|
||||||
],
|
|
||||||
"unicorn/prefer-includes": "error",
|
|
||||||
"unicorn/no-zero-fractions": "error",
|
|
||||||
"unicorn/prefer-string-starts-ends-with": "error",
|
|
||||||
"unicorn/prefer-default-parameters": "error",
|
|
||||||
"unicorn/prefer-negative-index": "error",
|
|
||||||
"unicorn/prefer-ternary": ["error", "only-single-line"],
|
|
||||||
"unicorn/prefer-array-find": "error",
|
|
||||||
"unicorn/no-lonely-if": "error",
|
|
||||||
"unicorn/no-hex-escape": "error",
|
|
||||||
"unicorn/escape-case": "error",
|
|
||||||
"unicorn/no-array-for-each": "error",
|
|
||||||
"unicorn/prefer-number-properties": "error",
|
|
||||||
"unicorn/prefer-native-coercion-functions": "error",
|
|
||||||
// TODO Enable
|
|
||||||
"unicorn/prefer-spread": "off"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
plugins: {
|
|
||||||
"@stylistic": stylistic
|
|
||||||
},
|
|
||||||
rules: {
|
|
||||||
"@stylistic/lines-between-class-members": "error",
|
|
||||||
"@stylistic/quotes": [
|
|
||||||
"error",
|
|
||||||
"double",
|
|
||||||
{ avoidEscape: true, allowTemplateLiterals: false }
|
|
||||||
],
|
|
||||||
"@stylistic/spaced-comment": [
|
|
||||||
"error",
|
|
||||||
"always",
|
|
||||||
{
|
|
||||||
line: {
|
|
||||||
markers: ["=", "!"], // Space here to support sprockets directives
|
|
||||||
exceptions: ["-", "+"]
|
|
||||||
},
|
|
||||||
block: {
|
|
||||||
markers: ["=", "!"], // Space here to support sprockets directives
|
|
||||||
exceptions: ["-", "+"],
|
|
||||||
balanced: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
...jsdocConfig,
|
|
||||||
settings: {
|
|
||||||
jsdoc: {
|
|
||||||
mode: "typescript",
|
|
||||||
// supported tags https://github.com/microsoft/TypeScript-wiki/blob/master/JSDoc-support-in-JavaScript.md
|
|
||||||
tagNamePreference: {
|
|
||||||
...["memberof", "yields", "member"].reduce((acc, tag) => {
|
|
||||||
acc[tag] = {
|
|
||||||
message: `@${tag} currently not supported in TypeScript`
|
|
||||||
};
|
|
||||||
return acc;
|
|
||||||
}, {}),
|
|
||||||
extends: "extends",
|
|
||||||
return: "returns",
|
|
||||||
constructor: "constructor",
|
|
||||||
prop: "property",
|
|
||||||
arg: "param",
|
|
||||||
augments: "extends",
|
|
||||||
description: false,
|
|
||||||
desc: false,
|
|
||||||
inheritdoc: false,
|
|
||||||
class: "constructor"
|
|
||||||
},
|
|
||||||
overrideReplacesDocs: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
rules: {
|
|
||||||
...jsdocConfig.rules,
|
|
||||||
// Override recommended
|
|
||||||
//
|
|
||||||
// Doesn't support function overloading/tuples/`readonly`/module keyword/etc
|
|
||||||
// Also `typescript` reports this itself
|
|
||||||
"jsdoc/valid-types": "off",
|
|
||||||
// A lot of false positive with loops/`switch`/`if`/etc
|
|
||||||
"jsdoc/require-returns-check": "off",
|
|
||||||
// TODO fix and enable in future
|
|
||||||
"jsdoc/require-property-description": "off",
|
"jsdoc/require-property-description": "off",
|
||||||
|
|
||||||
// More rules
|
// TODO enable me in future
|
||||||
"jsdoc/check-indentation": "error",
|
"unicorn/prefer-regexp-test": "off",
|
||||||
"jsdoc/check-line-alignment": ["error", "never"],
|
"unicorn/prefer-string-slice": "off",
|
||||||
"jsdoc/require-asterisk-prefix": "error",
|
|
||||||
"jsdoc/require-hyphen-before-param-description": ["error", "never"],
|
// TODO false positive, need to fix in upstream
|
||||||
"jsdoc/require-template": "error",
|
"n/prefer-node-protocol": "off",
|
||||||
"jsdoc/no-bad-blocks": "error",
|
"n/prefer-global/url": "off"
|
||||||
"jsdoc/no-blank-block-descriptions": "error",
|
|
||||||
"jsdoc/no-blank-blocks": "error",
|
|
||||||
"jsdoc/no-restricted-syntax": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
contexts: [
|
|
||||||
// Prefer TypeScript syntax for functions
|
|
||||||
{
|
|
||||||
comment: "JsdocBlock:has(JsdocTypeFunction[arrow=false])",
|
|
||||||
message:
|
|
||||||
"Please use TypeScript syntax - `(a: string, b: boolean) => number`"
|
|
||||||
},
|
|
||||||
// Prefer `{string=}` over `{string} [arg]`
|
|
||||||
{
|
|
||||||
comment:
|
|
||||||
"JsdocBlock:has(JsdocTag[tag=/^(property|param)$/][name=/[\\[\\]]/])",
|
|
||||||
message:
|
|
||||||
"Please use `@property {string=} property`/`@param {string=} arg` instead `[arg]` for optional properties and parameters"
|
|
||||||
},
|
|
||||||
// No `*` type
|
|
||||||
{
|
|
||||||
comment: "JsdocBlock:has(JsdocTypeAny)",
|
|
||||||
message: "Please use `any` or `EXPECTED_ANY` type."
|
|
||||||
},
|
|
||||||
// No `?` type
|
|
||||||
{
|
|
||||||
comment: "JsdocBlock:has(JsdocTypeUnknown)",
|
|
||||||
message: "Please use `unknown` or `any` (or `EXPECTED_ANY`) type"
|
|
||||||
},
|
|
||||||
// No `any` type
|
|
||||||
{
|
|
||||||
comment: "JsdocBlock:has(JsdocTypeName[value=/^any$/])",
|
|
||||||
message: "Please use provide types instead `any`"
|
|
||||||
},
|
|
||||||
// No `Function` type
|
|
||||||
{
|
|
||||||
comment:
|
|
||||||
"JsdocBlock:has(JsdocTypeName[value=/^(function|Function)$/])",
|
|
||||||
message:
|
|
||||||
"Please use provide types for function - `(a: number, b: number) -> number` instead `Function`/`function` or use `EXPECTED_FUNCTION` type"
|
|
||||||
},
|
|
||||||
// No `Object`
|
|
||||||
{
|
|
||||||
comment:
|
|
||||||
"JsdocBlock:has(JsdocTag[tag!=/^(typedef|template|param)$/]:has(JsdocTypeName[value=/^(Object|object)$/]))",
|
|
||||||
message:
|
|
||||||
"Please use provide types for object - `{ property: number:, result: () => number}` instead `Object`/`object` or use `EXPECTED_OBJECT` type"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
comment:
|
|
||||||
"JsdocBlock:has(JsdocTag[tag=typedef][parsedType.type!=JsdocTypeName]:has(JsdocTypeName[value=/^(Object|object)$/]))",
|
|
||||||
message:
|
|
||||||
"Please use provide types for object - `{ property: number:, result: () => number}` instead `Object`/`object` or use `EXPECTED_OBJECT` type"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
...jest.configs["flat/recommended"],
|
files: ["lib/**/*.js"],
|
||||||
files: ["test/**/*.{js,cjs,mjs}"],
|
extends: [configs["webpack/special"]]
|
||||||
languageOptions: {
|
|
||||||
ecmaVersion: "latest",
|
|
||||||
globals: {
|
|
||||||
...globals.jest,
|
|
||||||
nsObj: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
rules: {
|
|
||||||
...jest.configs["flat/recommended"].rules,
|
|
||||||
"jest/no-standalone-expect": "off",
|
|
||||||
"jest/valid-title": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
ignoreTypeOfDescribeName: true,
|
|
||||||
ignoreTypeOfTestName: true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"jest/no-done-callback": "off",
|
|
||||||
"jest/expect-expect": "off",
|
|
||||||
"jest/no-conditional-expect": "off",
|
|
||||||
"no-console": "off",
|
|
||||||
"jsdoc/require-jsdoc": "off",
|
|
||||||
"n/no-unsupported-features/es-syntax": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
version: ">=22",
|
|
||||||
ignores: []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"n/no-unsupported-features/es-builtins": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
version: ">=22",
|
|
||||||
ignores: []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"n/no-unsupported-features/node-builtins": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
allowExperimental: true,
|
|
||||||
version: ">=22",
|
|
||||||
ignores: []
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
files: ["lib/**/*.runtime.js", "hot/*.js"],
|
|
||||||
languageOptions: {
|
|
||||||
ecmaVersion: 5,
|
|
||||||
globals: {
|
|
||||||
...globals.browser,
|
|
||||||
...globals.es5
|
|
||||||
}
|
|
||||||
},
|
|
||||||
rules: {
|
|
||||||
"prefer-const": "off",
|
|
||||||
"object-shorthand": "off",
|
|
||||||
"no-undef-init": "off",
|
|
||||||
"no-var": "off",
|
|
||||||
"n/exports-style": "off",
|
|
||||||
"prefer-template": "off",
|
|
||||||
"no-implicit-coercion": "off",
|
|
||||||
"no-console": "off",
|
|
||||||
"func-style": "off",
|
|
||||||
"unicorn/prefer-includes": "off",
|
|
||||||
"unicorn/no-useless-undefined": "off",
|
|
||||||
"unicorn/no-array-for-each": "off",
|
|
||||||
"jsdoc/require-jsdoc": "off"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
files: ["bin/**/*.js"],
|
files: ["bin/**/*.js"],
|
||||||
|
@ -475,6 +113,8 @@ export default defineConfig([
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
"no-console": "off",
|
"no-console": "off",
|
||||||
|
|
||||||
|
// Allow to use `dynamic` import and hashbang
|
||||||
"n/no-unsupported-features/es-syntax": [
|
"n/no-unsupported-features/es-syntax": [
|
||||||
"error",
|
"error",
|
||||||
{
|
{
|
||||||
|
@ -484,34 +124,108 @@ export default defineConfig([
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
files: ["setup/**/*.js", "tooling/**/*.js"],
|
files: ["lib/**/*.runtime.js", "hot/*.js"],
|
||||||
// Allow to use `dynamic` import
|
extends: [configs["javascript/es5"]],
|
||||||
languageOptions: {
|
languageOptions: {
|
||||||
ecmaVersion: 2020
|
sourceType: "commonjs",
|
||||||
|
globals: {
|
||||||
|
...globals.browser,
|
||||||
|
...globals.es5,
|
||||||
|
Promise: false,
|
||||||
|
Map: false,
|
||||||
|
Set: false,
|
||||||
|
process: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
strict: "off",
|
||||||
|
|
||||||
|
"block-scoped-var": "off",
|
||||||
|
|
||||||
|
// Allow logging
|
||||||
|
"no-console": "off",
|
||||||
|
|
||||||
|
// We replace `$VAR$` on real code
|
||||||
|
"no-unused-vars": "off",
|
||||||
|
"no-undef-init": "off",
|
||||||
|
|
||||||
|
"id-length": "off",
|
||||||
|
|
||||||
|
"unicorn/no-array-for-each": "off",
|
||||||
|
"unicorn/prefer-includes": "off",
|
||||||
|
|
||||||
|
"jsdoc/require-jsdoc": "off",
|
||||||
|
|
||||||
|
// Revisit it in future
|
||||||
|
"no-use-before-define": "off",
|
||||||
|
"func-names": "off",
|
||||||
|
"func-style": "off"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
files: ["test/**/*.js"],
|
||||||
|
rules: {
|
||||||
|
// TODO enable me
|
||||||
|
strict: "off",
|
||||||
|
|
||||||
|
// No need here, we have custom test logic, so except can be placed in different places
|
||||||
|
"jest/no-standalone-expect": "off",
|
||||||
|
|
||||||
|
// We have a lot of custom tests
|
||||||
|
"jest/expect-expect": "off",
|
||||||
|
|
||||||
|
// We have a lot of custom tests
|
||||||
|
"jest/no-confusing-set-timeout": "off"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
files: ["test/helpers/**/*.{js,cjs,mjs}"],
|
||||||
|
languageOptions: {
|
||||||
|
globals: {
|
||||||
|
...globals.jest
|
||||||
|
}
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
"no-eval": "off",
|
||||||
|
"no-console": "off",
|
||||||
|
|
||||||
|
// Allow to use any builtins, syntax and node API in tests
|
||||||
|
"n/no-unsupported-features/es-builtins": "off",
|
||||||
|
"n/no-unsupported-features/es-syntax": "off",
|
||||||
|
"n/no-unsupported-features/node-builtins": "off"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
files: ["test/**/*.mjs"],
|
||||||
|
languageOptions: {
|
||||||
|
ecmaVersion: 2022
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
files: ["setup/**/*.js", "tooling/**/*.js"],
|
||||||
|
languageOptions: {
|
||||||
|
ecmaVersion: 2022
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
"no-console": "off"
|
"no-console": "off"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
files: [
|
files: ["test/Compiler-filesystem-caching.test.js"],
|
||||||
"test/configCases/{dll-plugin-entry,dll-plugin-side-effects,dll-plugin}/**/webpack.config.js",
|
languageOptions: {
|
||||||
"examples/**/*.js",
|
ecmaVersion: 2022
|
||||||
"test/NodeTemplatePlugin.test.js"
|
|
||||||
],
|
|
||||||
rules: {
|
|
||||||
"n/no-missing-require": "off"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
...prettierConfig,
|
files: [
|
||||||
plugins: {
|
"test/configCases/{dll-plugin-entry,dll-plugin-side-effects,dll-plugin}/**/webpack.config.js",
|
||||||
...prettierConfig.plugins,
|
"examples/**/*.js",
|
||||||
prettier
|
"test/NodeTemplatePlugin.test.js",
|
||||||
},
|
"test/PersistentCaching.test.js"
|
||||||
|
],
|
||||||
rules: {
|
rules: {
|
||||||
...prettierConfig.rules,
|
"import/extensions": "off",
|
||||||
"prettier/prettier": "error"
|
"import/no-unresolved": "off"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const { AggressiveMergingPlugin } = require("../..").optimize;
|
const { AggressiveMergingPlugin } = require("../..").optimize;
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
const svgToMiniDataURI = require("mini-svg-data-uri");
|
const svgToMiniDataURI = require("mini-svg-data-uri");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
output: {
|
output: {
|
||||||
assetModuleFilename: "images/[hash][ext]"
|
assetModuleFilename: "images/[hash][ext]"
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
// enable debug logging to see network requests!
|
// enable debug logging to see network requests!
|
||||||
// stats: {
|
// stats: {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
module.exports = [
|
module.exports = [
|
||||||
{
|
{
|
||||||
entry: "./example.js",
|
entry: "./example.js",
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
optimization: {
|
optimization: {
|
||||||
chunkIds: "named" // To keep filename consistent between different modes (for example building only)
|
chunkIds: "named" // To keep filename consistent between different modes (for example building only)
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
optimization: {
|
optimization: {
|
||||||
chunkIds: "named" // To keep filename consistent between different modes (for example building only)
|
chunkIds: "named" // To keep filename consistent between different modes (for example building only)
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
optimization: {
|
optimization: {
|
||||||
chunkIds: "named" // To keep filename consistent between different modes (for example building only)
|
chunkIds: "named" // To keep filename consistent between different modes (for example building only)
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
entry: {
|
entry: {
|
||||||
app: { import: "./app.js", dependOn: ["other-vendors"] },
|
app: { import: "./app.js", dependOn: ["other-vendors"] },
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
entry: {
|
entry: {
|
||||||
app: { import: "./app.js", dependOn: ["react-vendors"] },
|
app: { import: "./app.js", dependOn: ["react-vendors"] },
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
optimization: {
|
optimization: {
|
||||||
chunkIds: "deterministic" // To keep filename consistent between different modes (for example building only)
|
chunkIds: "deterministic" // To keep filename consistent between different modes (for example building only)
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
optimization: {
|
optimization: {
|
||||||
chunkIds: "deterministic" // To keep filename consistent between different modes (for example building only)
|
chunkIds: "deterministic" // To keep filename consistent between different modes (for example building only)
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
optimization: {
|
optimization: {
|
||||||
chunkIds: "deterministic" // To keep filename consistent between different modes (for example building only)
|
chunkIds: "deterministic" // To keep filename consistent between different modes (for example building only)
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
optimization: {
|
optimization: {
|
||||||
chunkIds: "deterministic" // To keep filename consistent between different modes (for example building only)
|
chunkIds: "deterministic" // To keep filename consistent between different modes (for example building only)
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
optimization: {
|
optimization: {
|
||||||
chunkIds: "named" // To keep filename consistent between different modes (for example building only)
|
chunkIds: "named" // To keep filename consistent between different modes (for example building only)
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
// mode: "development" || "production",
|
// mode: "development" || "production",
|
||||||
module: {
|
module: {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
output: {
|
output: {
|
||||||
uniqueName: "app"
|
uniqueName: "app"
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
const toml = require("toml");
|
const toml = require("toml");
|
||||||
const json5 = require("json5");
|
const json5 = require("json5");
|
||||||
const yaml = require("yamljs");
|
const yaml = require("yamljs");
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const webpack = require("../../");
|
const webpack = require("../../");
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const webpack = require("../../");
|
const webpack = require("../../");
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const webpack = require("../../");
|
const webpack = require("../../");
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const webpack = require("../../");
|
const webpack = require("../../");
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
// mode: "development" || "production",
|
// mode: "development" || "production",
|
||||||
output: {
|
output: {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
// mode: "development" || "production",
|
// mode: "development" || "production",
|
||||||
optimization: {
|
optimization: {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
// mode: "development" || "production",
|
// mode: "development" || "production",
|
||||||
optimization: {
|
optimization: {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
// mode: "development" || "production",
|
// mode: "development" || "production",
|
||||||
optimization: {
|
optimization: {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
optimization: {
|
optimization: {
|
||||||
chunkIds: "deterministic" // To keep filename consistent between different modes (for example building only)
|
chunkIds: "deterministic" // To keep filename consistent between different modes (for example building only)
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const webpack = require("../../");
|
const webpack = require("../../");
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
const { HotModuleReplacementPlugin } = require("../../");
|
const { HotModuleReplacementPlugin } = require("../../");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
// mode: "development" || "production",
|
// mode: "development" || "production",
|
||||||
module: {
|
module: {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
// mode: "development" || "production",
|
// mode: "development" || "production",
|
||||||
entry: {
|
entry: {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
optimization: {
|
optimization: {
|
||||||
chunkIds: "named" // To keep filename consistent between different modes (for example building only)
|
chunkIds: "named" // To keep filename consistent between different modes (for example building only)
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
output: {
|
output: {
|
||||||
module: true,
|
module: true,
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const { ModuleFederationPlugin } = require("../../").container;
|
const { ModuleFederationPlugin } = require("../../").container;
|
||||||
|
|
||||||
const rules = [
|
const rules = [
|
||||||
{
|
{
|
||||||
test: /\.js$/,
|
test: /\.js$/,
|
||||||
|
@ -22,6 +25,7 @@ const stats = {
|
||||||
chunkModules: true,
|
chunkModules: true,
|
||||||
chunkOrigins: true
|
chunkOrigins: true
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = (env = "development") => [
|
module.exports = (env = "development") => [
|
||||||
// For this example we have 3 configs in a single file
|
// For this example we have 3 configs in a single file
|
||||||
// In practice you probably would have separate config
|
// In practice you probably would have separate config
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
output: {
|
output: {
|
||||||
module: true,
|
module: true,
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
output: {
|
output: {
|
||||||
module: true,
|
module: true,
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const webpack = require("../../");
|
const webpack = require("../../");
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
// mode: "development" || "production",
|
// mode: "development" || "production",
|
||||||
entry: {
|
entry: {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
optimization: {
|
optimization: {
|
||||||
chunkIds: "named"
|
chunkIds: "named"
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
// mode: "development" || "production",
|
// mode: "development" || "production",
|
||||||
target: "node",
|
target: "node",
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
|
||||||
module.exports = (env = "development") => ({
|
module.exports = (env = "development") => ({
|
||||||
mode: env,
|
mode: env,
|
||||||
infrastructureLogging: {
|
infrastructureLogging: {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
// mode: "development" || "production",
|
// mode: "development" || "production",
|
||||||
optimization: {
|
optimization: {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
optimization: {
|
optimization: {
|
||||||
sideEffects: true
|
sideEffects: true
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
|
||||||
module.exports = [
|
module.exports = [
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
optimization: {
|
optimization: {
|
||||||
chunkIds: "named" // To keep filename consistent between different modes (for example building only)
|
chunkIds: "named" // To keep filename consistent between different modes (for example building only)
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin");
|
const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin");
|
||||||
|
|
||||||
module.exports = (env = "development") => ({
|
module.exports = (env = "development") => ({
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
{
|
{
|
||||||
"name": "hi-wasm",
|
"name": "hi-wasm",
|
||||||
"type": "module",
|
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
|
"sideEffects": false,
|
||||||
|
"type": "module",
|
||||||
|
"main": "hi_wasm.js",
|
||||||
|
"types": "hi_wasm.d.ts",
|
||||||
"files": [
|
"files": [
|
||||||
"hi_wasm_bg.wasm",
|
"hi_wasm_bg.wasm",
|
||||||
"hi_wasm.js",
|
"hi_wasm.js",
|
||||||
"hi_wasm_bg.js",
|
"hi_wasm_bg.js",
|
||||||
"hi_wasm.d.ts"
|
"hi_wasm.d.ts"
|
||||||
],
|
]
|
||||||
"main": "hi_wasm.js",
|
|
||||||
"types": "hi_wasm.d.ts",
|
|
||||||
"sideEffects": false
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
// mode: "development || "production",
|
// mode: "development || "production",
|
||||||
output: {
|
output: {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
// mode: "development" || "production",
|
// mode: "development" || "production",
|
||||||
output: {
|
output: {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
// mode: "development" || "production",
|
// mode: "development" || "production",
|
||||||
output: {
|
output: {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
nameMapping: {
|
nameMapping: {
|
||||||
FsStats: /^Stats Import fs/,
|
FsStats: /^Stats Import fs/,
|
||||||
|
|
30
hot/log.js
30
hot/log.js
|
@ -45,6 +45,21 @@ module.exports = function (level, msg) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {Error} err error
|
||||||
|
* @returns {string} formatted error
|
||||||
|
*/
|
||||||
|
module.exports.formatError = function (err) {
|
||||||
|
var message = err.message;
|
||||||
|
var stack = err.stack;
|
||||||
|
if (!stack) {
|
||||||
|
return message;
|
||||||
|
} else if (stack.indexOf(message) < 0) {
|
||||||
|
return message + "\n" + stack;
|
||||||
|
}
|
||||||
|
return stack;
|
||||||
|
};
|
||||||
|
|
||||||
var group = console.group || dummy;
|
var group = console.group || dummy;
|
||||||
var groupCollapsed = console.groupCollapsed || dummy;
|
var groupCollapsed = console.groupCollapsed || dummy;
|
||||||
var groupEnd = console.groupEnd || dummy;
|
var groupEnd = console.groupEnd || dummy;
|
||||||
|
@ -61,18 +76,3 @@ module.exports.groupEnd = logGroup(groupEnd);
|
||||||
module.exports.setLogLevel = function (level) {
|
module.exports.setLogLevel = function (level) {
|
||||||
logLevel = level;
|
logLevel = level;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {Error} err error
|
|
||||||
* @returns {string} formatted error
|
|
||||||
*/
|
|
||||||
module.exports.formatError = function (err) {
|
|
||||||
var message = err.message;
|
|
||||||
var stack = err.stack;
|
|
||||||
if (!stack) {
|
|
||||||
return message;
|
|
||||||
} else if (stack.indexOf(message) < 0) {
|
|
||||||
return message + "\n" + stack;
|
|
||||||
}
|
|
||||||
return stack;
|
|
||||||
};
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
*/
|
*/
|
||||||
/* globals __resourceQuery */
|
/* globals __resourceQuery */
|
||||||
if (module.hot) {
|
if (module.hot) {
|
||||||
|
// eslint-disable-next-line no-implicit-coercion
|
||||||
var hotPollInterval = +__resourceQuery.slice(1) || 10 * 60 * 1000;
|
var hotPollInterval = +__resourceQuery.slice(1) || 10 * 60 * 1000;
|
||||||
var log = require("./log");
|
var log = require("./log");
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/** @type {import('jest').Config} */
|
/** @type {import('jest').Config} */
|
||||||
const config = {
|
const config = {
|
||||||
prettierPath: require.resolve("prettier-2"),
|
prettierPath: require.resolve("prettier-2"),
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const WebpackError = require("./WebpackError");
|
const WebpackError = require("./WebpackError");
|
||||||
|
|
||||||
const CURRENT_METHOD_REGEXP = /at ([a-zA-Z0-9_.]*)/;
|
const CURRENT_METHOD_REGEXP = /at ([a-zA-Z0-9_.]*)/;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -62,4 +62,5 @@ class AutomaticPrefetchPlugin {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = AutomaticPrefetchPlugin;
|
module.exports = AutomaticPrefetchPlugin;
|
||||||
|
|
|
@ -20,7 +20,7 @@ const createSchemaValidation = require("./util/create-schema-validation");
|
||||||
|
|
||||||
const validate = createSchemaValidation(
|
const validate = createSchemaValidation(
|
||||||
/** @type {((value: typeof import("../schemas/plugins/BannerPlugin.json")) => boolean)} */
|
/** @type {((value: typeof import("../schemas/plugins/BannerPlugin.json")) => boolean)} */
|
||||||
(require("../schemas/plugins/BannerPlugin.check.js")),
|
(require("../schemas/plugins/BannerPlugin.check")),
|
||||||
() => require("../schemas/plugins/BannerPlugin.json"),
|
() => require("../schemas/plugins/BannerPlugin.json"),
|
||||||
{
|
{
|
||||||
name: "Banner Plugin",
|
name: "Banner Plugin",
|
||||||
|
|
|
@ -420,8 +420,9 @@ class ChunkGraph {
|
||||||
*/
|
*/
|
||||||
attachDependentHashModules(chunk, modules) {
|
attachDependentHashModules(chunk, modules) {
|
||||||
const cgc = this._getChunkGraphChunk(chunk);
|
const cgc = this._getChunkGraphChunk(chunk);
|
||||||
if (cgc.dependentHashModules === undefined)
|
if (cgc.dependentHashModules === undefined) {
|
||||||
cgc.dependentHashModules = new Set();
|
cgc.dependentHashModules = new Set();
|
||||||
|
}
|
||||||
for (const module of modules) {
|
for (const module of modules) {
|
||||||
cgc.dependentHashModules.add(module);
|
cgc.dependentHashModules.add(module);
|
||||||
}
|
}
|
||||||
|
@ -1117,8 +1118,9 @@ class ChunkGraph {
|
||||||
*/
|
*/
|
||||||
addDependentHashModuleToChunk(chunk, module) {
|
addDependentHashModuleToChunk(chunk, module) {
|
||||||
const cgc = this._getChunkGraphChunk(chunk);
|
const cgc = this._getChunkGraphChunk(chunk);
|
||||||
if (cgc.dependentHashModules === undefined)
|
if (cgc.dependentHashModules === undefined) {
|
||||||
cgc.dependentHashModules = new Set();
|
cgc.dependentHashModules = new Set();
|
||||||
|
}
|
||||||
cgc.dependentHashModules.add(module);
|
cgc.dependentHashModules.add(module);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1646,8 +1648,9 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza
|
||||||
const module = connection.module;
|
const module = connection.module;
|
||||||
stateInfo += module.getExportsType(this.moduleGraph, strict);
|
stateInfo += module.getExportsType(this.moduleGraph, strict);
|
||||||
// cspell:word Tnamespace
|
// cspell:word Tnamespace
|
||||||
if (stateInfo === "Tnamespace") activeNamespaceModules.add(module);
|
if (stateInfo === "Tnamespace") {
|
||||||
else {
|
activeNamespaceModules.add(module);
|
||||||
|
} else {
|
||||||
const oldModule = connectedModules.get(stateInfo);
|
const oldModule = connectedModules.get(stateInfo);
|
||||||
if (oldModule === undefined) {
|
if (oldModule === undefined) {
|
||||||
connectedModules.set(stateInfo, module);
|
connectedModules.set(stateInfo, module);
|
||||||
|
@ -1687,8 +1690,9 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// cspell:word Tnamespace
|
// cspell:word Tnamespace
|
||||||
if (activeNamespaceModules.size === 0 && connectedModules.size === 0)
|
if (activeNamespaceModules.size === 0 && connectedModules.size === 0) {
|
||||||
return graphHash;
|
return graphHash;
|
||||||
|
}
|
||||||
const connectedModulesInOrder =
|
const connectedModulesInOrder =
|
||||||
connectedModules.size > 1
|
connectedModules.size > 1
|
||||||
? Array.from(connectedModules).sort(([a], [b]) => (a < b ? -1 : 1))
|
? Array.from(connectedModules).sort(([a], [b]) => (a < b ? -1 : 1))
|
||||||
|
@ -1712,9 +1716,7 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza
|
||||||
const addModulesToHash = modules => {
|
const addModulesToHash = modules => {
|
||||||
let xor = ZERO_BIG_INT;
|
let xor = ZERO_BIG_INT;
|
||||||
for (const m of modules) {
|
for (const m of modules) {
|
||||||
xor =
|
xor ^= this._getModuleGraphHashBigInt(
|
||||||
xor ^
|
|
||||||
this._getModuleGraphHashBigInt(
|
|
||||||
this._getChunkGraphModule(m),
|
this._getChunkGraphModule(m),
|
||||||
m,
|
m,
|
||||||
runtime
|
runtime
|
||||||
|
@ -1722,12 +1724,13 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza
|
||||||
}
|
}
|
||||||
hash.update(xor.toString(16));
|
hash.update(xor.toString(16));
|
||||||
};
|
};
|
||||||
if (activeNamespaceModules.size === 1)
|
if (activeNamespaceModules.size === 1) {
|
||||||
addModuleToHash(
|
addModuleToHash(
|
||||||
/** @type {Module} */ (activeNamespaceModules.values().next().value)
|
/** @type {Module} */ (activeNamespaceModules.values().next().value)
|
||||||
);
|
);
|
||||||
else if (activeNamespaceModules.size > 1)
|
} else if (activeNamespaceModules.size > 1) {
|
||||||
addModulesToHash(activeNamespaceModules);
|
addModulesToHash(activeNamespaceModules);
|
||||||
|
}
|
||||||
for (const [stateInfo, modules] of connectedModulesInOrder) {
|
for (const [stateInfo, modules] of connectedModulesInOrder) {
|
||||||
hash.update(stateInfo);
|
hash.update(stateInfo);
|
||||||
if (modules instanceof Set) {
|
if (modules instanceof Set) {
|
||||||
|
@ -1767,12 +1770,13 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza
|
||||||
*/
|
*/
|
||||||
module => {
|
module => {
|
||||||
const chunkGraph = chunkGraphForModuleMap.get(module);
|
const chunkGraph = chunkGraphForModuleMap.get(module);
|
||||||
if (!chunkGraph)
|
if (!chunkGraph) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`${
|
`${
|
||||||
deprecateMessage
|
deprecateMessage
|
||||||
}: There was no ChunkGraph assigned to the Module for backward-compat (Use the new API)`
|
}: There was no ChunkGraph assigned to the Module for backward-compat (Use the new API)`
|
||||||
);
|
);
|
||||||
|
}
|
||||||
return chunkGraph;
|
return chunkGraph;
|
||||||
},
|
},
|
||||||
`${deprecateMessage}: Use new ChunkGraph API`,
|
`${deprecateMessage}: Use new ChunkGraph API`,
|
||||||
|
@ -1818,12 +1822,13 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza
|
||||||
*/
|
*/
|
||||||
chunk => {
|
chunk => {
|
||||||
const chunkGraph = chunkGraphForChunkMap.get(chunk);
|
const chunkGraph = chunkGraphForChunkMap.get(chunk);
|
||||||
if (!chunkGraph)
|
if (!chunkGraph) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`${
|
`${
|
||||||
deprecateMessage
|
deprecateMessage
|
||||||
}There was no ChunkGraph assigned to the Chunk for backward-compat (Use the new API)`
|
}There was no ChunkGraph assigned to the Chunk for backward-compat (Use the new API)`
|
||||||
);
|
);
|
||||||
|
}
|
||||||
return chunkGraph;
|
return chunkGraph;
|
||||||
},
|
},
|
||||||
`${deprecateMessage}: Use new ChunkGraph API`,
|
`${deprecateMessage}: Use new ChunkGraph API`,
|
||||||
|
|
|
@ -37,6 +37,7 @@ const validate = createSchemaValidation(
|
||||||
undefined,
|
undefined,
|
||||||
() => {
|
() => {
|
||||||
const { definitions } = require("../schemas/WebpackOptions.json");
|
const { definitions } = require("../schemas/WebpackOptions.json");
|
||||||
|
|
||||||
return {
|
return {
|
||||||
definitions,
|
definitions,
|
||||||
oneOf: [{ $ref: "#/definitions/CleanOptions" }]
|
oneOf: [{ $ref: "#/definitions/CleanOptions" }]
|
||||||
|
|
|
@ -44,8 +44,9 @@ class CompatibilityPlugin {
|
||||||
if (
|
if (
|
||||||
parserOptions.browserify !== undefined &&
|
parserOptions.browserify !== undefined &&
|
||||||
!parserOptions.browserify
|
!parserOptions.browserify
|
||||||
)
|
) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
parser.hooks.call.for("require").tap(
|
parser.hooks.call.for("require").tap(
|
||||||
PLUGIN_NAME,
|
PLUGIN_NAME,
|
||||||
|
@ -75,9 +76,10 @@ class CompatibilityPlugin {
|
||||||
last.options.request === "." &&
|
last.options.request === "." &&
|
||||||
last.userRequest === "." &&
|
last.userRequest === "." &&
|
||||||
last.options.recursive
|
last.options.recursive
|
||||||
)
|
) {
|
||||||
parser.state.current.dependencies.pop();
|
parser.state.current.dependencies.pop();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
parser.state.module.addPresentationalDependency(dep);
|
parser.state.module.addPresentationalDependency(dep);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -191,4 +193,5 @@ class CompatibilityPlugin {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = CompatibilityPlugin;
|
module.exports = CompatibilityPlugin;
|
||||||
|
|
|
@ -530,8 +530,9 @@ class Compilation {
|
||||||
if (
|
if (
|
||||||
/** @type {ProcessedAssets} */
|
/** @type {ProcessedAssets} */
|
||||||
(processedAssets).has(this.assets)
|
(processedAssets).has(this.assets)
|
||||||
)
|
) {
|
||||||
additionalAssetsFn(assets);
|
additionalAssetsFn(assets);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
|
@ -548,8 +549,9 @@ class Compilation {
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return callback(/** @type {Error} */ (err));
|
return callback(/** @type {Error} */ (err));
|
||||||
}
|
}
|
||||||
if (processedAssets !== undefined)
|
if (processedAssets !== undefined) {
|
||||||
processedAssets.add(this.assets);
|
processedAssets.add(this.assets);
|
||||||
|
}
|
||||||
const newAssets = popNewAssets(assets);
|
const newAssets = popNewAssets(assets);
|
||||||
if (newAssets !== undefined) {
|
if (newAssets !== undefined) {
|
||||||
this.hooks.processAdditionalAssets.callAsync(
|
this.hooks.processAdditionalAssets.callAsync(
|
||||||
|
@ -569,8 +571,9 @@ class Compilation {
|
||||||
if (
|
if (
|
||||||
/** @type {ProcessedAssets} */
|
/** @type {ProcessedAssets} */
|
||||||
(processedAssets).has(this.assets)
|
(processedAssets).has(this.assets)
|
||||||
)
|
) {
|
||||||
return additionalAssetsFn(assets, callback);
|
return additionalAssetsFn(assets, callback);
|
||||||
|
}
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -591,8 +594,9 @@ class Compilation {
|
||||||
*/
|
*/
|
||||||
err => {
|
err => {
|
||||||
if (err) return callback(err);
|
if (err) return callback(err);
|
||||||
if (processedAssets !== undefined)
|
if (processedAssets !== undefined) {
|
||||||
processedAssets.add(this.assets);
|
processedAssets.add(this.assets);
|
||||||
|
}
|
||||||
const newAssets = popNewAssets(assets);
|
const newAssets = popNewAssets(assets);
|
||||||
if (newAssets !== undefined) {
|
if (newAssets !== undefined) {
|
||||||
this.hooks.processAdditionalAssets.callAsync(
|
this.hooks.processAdditionalAssets.callAsync(
|
||||||
|
@ -612,8 +616,9 @@ class Compilation {
|
||||||
if (
|
if (
|
||||||
/** @type {ProcessedAssets} */
|
/** @type {ProcessedAssets} */
|
||||||
(processedAssets).has(this.assets)
|
(processedAssets).has(this.assets)
|
||||||
)
|
) {
|
||||||
return additionalAssetsFn(assets);
|
return additionalAssetsFn(assets);
|
||||||
|
}
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -627,8 +632,9 @@ class Compilation {
|
||||||
const p = fn(assets);
|
const p = fn(assets);
|
||||||
if (!p || !p.then) return p;
|
if (!p || !p.then) return p;
|
||||||
return p.then(() => {
|
return p.then(() => {
|
||||||
if (processedAssets !== undefined)
|
if (processedAssets !== undefined) {
|
||||||
processedAssets.add(this.assets);
|
processedAssets.add(this.assets);
|
||||||
|
}
|
||||||
const newAssets = popNewAssets(assets);
|
const newAssets = popNewAssets(assets);
|
||||||
if (newAssets !== undefined) {
|
if (newAssets !== undefined) {
|
||||||
return this.hooks.processAdditionalAssets.promise(
|
return this.hooks.processAdditionalAssets.promise(
|
||||||
|
@ -1231,7 +1237,6 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
||||||
// properties in the prototype chain
|
// properties in the prototype chain
|
||||||
/** @type {Partial<NormalizedStatsOptions>} */
|
/** @type {Partial<NormalizedStatsOptions>} */
|
||||||
const options = {};
|
const options = {};
|
||||||
// eslint-disable-next-line guard-for-in
|
|
||||||
for (const key in optionsOrPreset) {
|
for (const key in optionsOrPreset) {
|
||||||
options[key] = optionsOrPreset[/** @type {keyof StatsOptions} */ (key)];
|
options[key] = optionsOrPreset[/** @type {keyof StatsOptions} */ (key)];
|
||||||
}
|
}
|
||||||
|
@ -1444,8 +1449,9 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
||||||
}
|
}
|
||||||
this._modules.set(identifier, module);
|
this._modules.set(identifier, module);
|
||||||
this.modules.add(module);
|
this.modules.add(module);
|
||||||
if (this._backCompat)
|
if (this._backCompat) {
|
||||||
ModuleGraph.setModuleGraphForModule(module, this.moduleGraph);
|
ModuleGraph.setModuleGraphForModule(module, this.moduleGraph);
|
||||||
|
}
|
||||||
if (currentProfile !== undefined) {
|
if (currentProfile !== undefined) {
|
||||||
currentProfile.markIntegrationEnd();
|
currentProfile.markIntegrationEnd();
|
||||||
}
|
}
|
||||||
|
@ -1738,9 +1744,10 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
||||||
inProgressTransitive = -1;
|
inProgressTransitive = -1;
|
||||||
onTransitiveTasksFinished(err);
|
onTransitiveTasksFinished(err);
|
||||||
}
|
}
|
||||||
if (--inProgressTransitive === 0)
|
if (--inProgressTransitive === 0) {
|
||||||
return onTransitiveTasksFinished();
|
return onTransitiveTasksFinished();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
);
|
);
|
||||||
if (--inProgressSorting === 0) onDependenciesSorted();
|
if (--inProgressSorting === 0) onDependenciesSorted();
|
||||||
return;
|
return;
|
||||||
|
@ -1890,8 +1897,9 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
||||||
|
|
||||||
this._modules.set(module.identifier(), module);
|
this._modules.set(module.identifier(), module);
|
||||||
this.modules.add(module);
|
this.modules.add(module);
|
||||||
if (this._backCompat)
|
if (this._backCompat) {
|
||||||
ModuleGraph.setModuleGraphForModule(module, this.moduleGraph);
|
ModuleGraph.setModuleGraphForModule(module, this.moduleGraph);
|
||||||
|
}
|
||||||
|
|
||||||
this._handleModuleBuildAndDependencies(
|
this._handleModuleBuildAndDependencies(
|
||||||
originModule,
|
originModule,
|
||||||
|
@ -2782,7 +2790,9 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
||||||
this.factorizeQueue.clear();
|
this.factorizeQueue.clear();
|
||||||
if (this.profile) {
|
if (this.profile) {
|
||||||
this.logger.time("finish module profiles");
|
this.logger.time("finish module profiles");
|
||||||
|
|
||||||
const ParallelismFactorCalculator = require("./util/ParallelismFactorCalculator");
|
const ParallelismFactorCalculator = require("./util/ParallelismFactorCalculator");
|
||||||
|
|
||||||
const p = new ParallelismFactorCalculator();
|
const p = new ParallelismFactorCalculator();
|
||||||
const moduleGraph = this.moduleGraph;
|
const moduleGraph = this.moduleGraph;
|
||||||
/** @type {Map<Module, ModuleProfile>} */
|
/** @type {Map<Module, ModuleProfile>} */
|
||||||
|
@ -3455,9 +3465,10 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.reportDependencyErrorsAndWarnings(module, block.blocks))
|
if (this.reportDependencyErrorsAndWarnings(module, block.blocks)) {
|
||||||
hasProblems = true;
|
hasProblems = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return hasProblems;
|
return hasProblems;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3841,8 +3852,9 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
|
||||||
*/
|
*/
|
||||||
addRuntimeModule(chunk, module, chunkGraph = this.chunkGraph) {
|
addRuntimeModule(chunk, module, chunkGraph = this.chunkGraph) {
|
||||||
// Deprecated ModuleGraph association
|
// Deprecated ModuleGraph association
|
||||||
if (this._backCompat)
|
if (this._backCompat) {
|
||||||
ModuleGraph.setModuleGraphForModule(module, this.moduleGraph);
|
ModuleGraph.setModuleGraphForModule(module, this.moduleGraph);
|
||||||
|
}
|
||||||
|
|
||||||
// add it to the list
|
// add it to the list
|
||||||
this.modules.add(module);
|
this.modules.add(module);
|
||||||
|
@ -3914,7 +3926,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const chunkGroup = new ChunkGroup(groupOptions);
|
const chunkGroup = new ChunkGroup(groupOptions);
|
||||||
if (module)
|
if (module) {
|
||||||
chunkGroup.addOrigin(
|
chunkGroup.addOrigin(
|
||||||
module,
|
module,
|
||||||
/** @type {DependencyLocation} */
|
/** @type {DependencyLocation} */
|
||||||
|
@ -3922,6 +3934,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
|
||||||
/** @type {string} */
|
/** @type {string} */
|
||||||
(request)
|
(request)
|
||||||
);
|
);
|
||||||
|
}
|
||||||
const chunk = this.addChunk(name);
|
const chunk = this.addChunk(name);
|
||||||
|
|
||||||
connectChunkGroupAndChunk(chunkGroup, chunk);
|
connectChunkGroupAndChunk(chunkGroup, chunk);
|
||||||
|
@ -3991,8 +4004,9 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
|
||||||
}
|
}
|
||||||
const chunk = new Chunk(name, this._backCompat);
|
const chunk = new Chunk(name, this._backCompat);
|
||||||
this.chunks.add(chunk);
|
this.chunks.add(chunk);
|
||||||
if (this._backCompat)
|
if (this._backCompat) {
|
||||||
ChunkGraph.setChunkGraphForChunk(chunk, this.chunkGraph);
|
ChunkGraph.setChunkGraphForChunk(chunk, this.chunkGraph);
|
||||||
|
}
|
||||||
if (name) {
|
if (name) {
|
||||||
this.namedChunks.set(name, chunk);
|
this.namedChunks.set(name, chunk);
|
||||||
}
|
}
|
||||||
|
@ -4772,7 +4786,9 @@ This prevents using hashes of each other and should be avoided.`);
|
||||||
newEntry = entry.map(x => (x === file ? newFile : x));
|
newEntry = entry.map(x => (x === file ? newFile : x));
|
||||||
} else if (entry === file) {
|
} else if (entry === file) {
|
||||||
newEntry = newFile;
|
newEntry = newFile;
|
||||||
} else continue;
|
} else {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
this.assetsInfo.set(name, {
|
this.assetsInfo.set(name, {
|
||||||
...info,
|
...info,
|
||||||
related: {
|
related: {
|
||||||
|
@ -5500,6 +5516,7 @@ This prevents using hashes of each other and should be avoided.`);
|
||||||
(moduleArgumentsMap.get(runtimeModule))
|
(moduleArgumentsMap.get(runtimeModule))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
exports = __webpack_require__(module.identifier());
|
exports = __webpack_require__(module.identifier());
|
||||||
} catch (execErr) {
|
} catch (execErr) {
|
||||||
const { message, stack, module } =
|
const { message, stack, module } =
|
||||||
|
|
|
@ -1167,7 +1167,7 @@ ${other}`);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.records = parseJson(
|
this.records = parseJson(
|
||||||
/** @type {Buffer} */ (content).toString("utf-8")
|
/** @type {Buffer} */ (content).toString("utf8")
|
||||||
);
|
);
|
||||||
} catch (parseErr) {
|
} catch (parseErr) {
|
||||||
return callback(
|
return callback(
|
||||||
|
|
|
@ -109,7 +109,7 @@ class ConcatenationScope {
|
||||||
? "_asiSafe0"
|
? "_asiSafe0"
|
||||||
: "";
|
: "";
|
||||||
const exportData = ids
|
const exportData = ids
|
||||||
? Buffer.from(JSON.stringify(ids), "utf-8").toString("hex")
|
? Buffer.from(JSON.stringify(ids), "utf8").toString("hex")
|
||||||
: "ns";
|
: "ns";
|
||||||
// a "._" is appended to allow "delete ...", which would cause a SyntaxError in strict mode
|
// a "._" is appended to allow "delete ...", which would cause a SyntaxError in strict mode
|
||||||
return `__WEBPACK_MODULE_REFERENCE__${info.index}_${exportData}${callFlag}${directImportFlag}${deferredImportFlag}${asiSafeFlag}__._`;
|
return `__WEBPACK_MODULE_REFERENCE__${info.index}_${exportData}${callFlag}${directImportFlag}${deferredImportFlag}${asiSafeFlag}__._`;
|
||||||
|
@ -137,7 +137,7 @@ class ConcatenationScope {
|
||||||
ids:
|
ids:
|
||||||
match[2] === "ns"
|
match[2] === "ns"
|
||||||
? []
|
? []
|
||||||
: JSON.parse(Buffer.from(match[2], "hex").toString("utf-8")),
|
: JSON.parse(Buffer.from(match[2], "hex").toString("utf8")),
|
||||||
call: Boolean(match[3]),
|
call: Boolean(match[3]),
|
||||||
directImport: Boolean(match[4]),
|
directImport: Boolean(match[4]),
|
||||||
deferredImport: Boolean(match[5]),
|
deferredImport: Boolean(match[5]),
|
||||||
|
|
|
@ -189,8 +189,9 @@ class ConstPlugin {
|
||||||
parser.scope.isAsmJs ||
|
parser.scope.isAsmJs ||
|
||||||
// Check top level scope here again
|
// Check top level scope here again
|
||||||
parser.scope.topLevelScope === true
|
parser.scope.topLevelScope === true
|
||||||
)
|
) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
this.eliminateUnusedStatement(parser, statement);
|
this.eliminateUnusedStatement(parser, statement);
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
|
@ -412,8 +412,9 @@ class ContextModule extends Module {
|
||||||
const buildInfo = /** @type {BuildInfo} */ (this.buildInfo);
|
const buildInfo = /** @type {BuildInfo} */ (this.buildInfo);
|
||||||
|
|
||||||
// always build when we have no snapshot and context
|
// always build when we have no snapshot and context
|
||||||
if (!buildInfo.snapshot)
|
if (!buildInfo.snapshot) {
|
||||||
return callback(null, Boolean(this.context || this.options.resource));
|
return callback(null, Boolean(this.context || this.options.resource));
|
||||||
|
}
|
||||||
|
|
||||||
fileSystemInfo.checkSnapshotValid(buildInfo.snapshot, (err, valid) => {
|
fileSystemInfo.checkSnapshotValid(buildInfo.snapshot, (err, valid) => {
|
||||||
callback(err, !valid);
|
callback(err, !valid);
|
||||||
|
@ -1188,9 +1189,11 @@ module.exports = webpackEmptyAsyncContext;`;
|
||||||
this.dependencies.length > 0
|
this.dependencies.length > 0
|
||||||
? /** @type {ContextElementDependency[]} */ (this.dependencies).slice()
|
? /** @type {ContextElementDependency[]} */ (this.dependencies).slice()
|
||||||
: [];
|
: [];
|
||||||
for (const block of this.blocks)
|
for (const block of this.blocks) {
|
||||||
for (const dep of block.dependencies)
|
for (const dep of block.dependencies) {
|
||||||
allDeps.push(/** @type {ContextElementDependency} */ (dep));
|
allDeps.push(/** @type {ContextElementDependency} */ (dep));
|
||||||
|
}
|
||||||
|
}
|
||||||
set.add(RuntimeGlobals.module);
|
set.add(RuntimeGlobals.module);
|
||||||
set.add(RuntimeGlobals.hasOwnProperty);
|
set.add(RuntimeGlobals.hasOwnProperty);
|
||||||
if (allDeps.length > 0) {
|
if (allDeps.length > 0) {
|
||||||
|
|
|
@ -344,8 +344,9 @@ module.exports = class ContextModuleFactory extends ModuleFactory {
|
||||||
const processedFiles = cmf.hooks.contextModuleFiles.call(
|
const processedFiles = cmf.hooks.contextModuleFiles.call(
|
||||||
/** @type {string[]} */ (files).map(file => file.normalize("NFC"))
|
/** @type {string[]} */ (files).map(file => file.normalize("NFC"))
|
||||||
);
|
);
|
||||||
if (!processedFiles || processedFiles.length === 0)
|
if (!processedFiles || processedFiles.length === 0) {
|
||||||
return callback(null, []);
|
return callback(null, []);
|
||||||
|
}
|
||||||
asyncLib.map(
|
asyncLib.map(
|
||||||
processedFiles.filter(p => p.indexOf(".") !== 0),
|
processedFiles.filter(p => p.indexOf(".") !== 0),
|
||||||
(segment, callback) => {
|
(segment, callback) => {
|
||||||
|
|
|
@ -388,8 +388,9 @@ class DefinePlugin {
|
||||||
const buildInfo = /** @type {BuildInfo} */ (
|
const buildInfo = /** @type {BuildInfo} */ (
|
||||||
parser.state.module.buildInfo
|
parser.state.module.buildInfo
|
||||||
);
|
);
|
||||||
if (!buildInfo.valueDependencies)
|
if (!buildInfo.valueDependencies) {
|
||||||
buildInfo.valueDependencies = new Map();
|
buildInfo.valueDependencies = new Map();
|
||||||
|
}
|
||||||
buildInfo.valueDependencies.set(VALUE_DEP_MAIN, mainValue);
|
buildInfo.valueDependencies.set(VALUE_DEP_MAIN, mainValue);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -717,4 +718,5 @@ class DefinePlugin {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = DefinePlugin;
|
module.exports = DefinePlugin;
|
||||||
|
|
|
@ -110,4 +110,5 @@ class DelegatedModuleFactoryPlugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = DelegatedModuleFactoryPlugin;
|
module.exports = DelegatedModuleFactoryPlugin;
|
||||||
|
|
|
@ -62,6 +62,7 @@ class DependencyTemplate {
|
||||||
*/
|
*/
|
||||||
apply(dependency, source, templateContext) {
|
apply(dependency, source, templateContext) {
|
||||||
const AbstractMethodError = require("./AbstractMethodError");
|
const AbstractMethodError = require("./AbstractMethodError");
|
||||||
|
|
||||||
throw new AbstractMethodError();
|
throw new AbstractMethodError();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ const createSchemaValidation = require("./util/create-schema-validation");
|
||||||
/** @typedef {import("./DllEntryPlugin").Options} Options */
|
/** @typedef {import("./DllEntryPlugin").Options} Options */
|
||||||
|
|
||||||
const validate = createSchemaValidation(
|
const validate = createSchemaValidation(
|
||||||
require("../schemas/plugins/DllPlugin.check.js"),
|
require("../schemas/plugins/DllPlugin.check"),
|
||||||
() => require("../schemas/plugins/DllPlugin.json"),
|
() => require("../schemas/plugins/DllPlugin.json"),
|
||||||
{
|
{
|
||||||
name: "Dll Plugin",
|
name: "Dll Plugin",
|
||||||
|
|
|
@ -22,7 +22,7 @@ const makePathsRelative = require("./util/identifier").makePathsRelative;
|
||||||
/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */
|
/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */
|
||||||
|
|
||||||
const validate = createSchemaValidation(
|
const validate = createSchemaValidation(
|
||||||
require("../schemas/plugins/DllReferencePlugin.check.js"),
|
require("../schemas/plugins/DllReferencePlugin.check"),
|
||||||
() => require("../schemas/plugins/DllReferencePlugin.json"),
|
() => require("../schemas/plugins/DllReferencePlugin.json"),
|
||||||
{
|
{
|
||||||
name: "Dll Reference Plugin",
|
name: "Dll Reference Plugin",
|
||||||
|
@ -78,7 +78,7 @@ class DllReferencePlugin {
|
||||||
// or malformed manifest files don't kill the process.
|
// or malformed manifest files don't kill the process.
|
||||||
try {
|
try {
|
||||||
data.data = parseJson(
|
data.data = parseJson(
|
||||||
/** @type {Buffer} */ (result).toString("utf-8")
|
/** @type {Buffer} */ (result).toString("utf8")
|
||||||
);
|
);
|
||||||
} catch (parseErr) {
|
} catch (parseErr) {
|
||||||
// Store the error in the params so that it can
|
// Store the error in the params so that it can
|
||||||
|
|
|
@ -33,9 +33,11 @@ class EntryOptionPlugin {
|
||||||
static applyEntryOption(compiler, context, entry) {
|
static applyEntryOption(compiler, context, entry) {
|
||||||
if (typeof entry === "function") {
|
if (typeof entry === "function") {
|
||||||
const DynamicEntryPlugin = require("./DynamicEntryPlugin");
|
const DynamicEntryPlugin = require("./DynamicEntryPlugin");
|
||||||
|
|
||||||
new DynamicEntryPlugin(context, entry).apply(compiler);
|
new DynamicEntryPlugin(context, entry).apply(compiler);
|
||||||
} else {
|
} else {
|
||||||
const EntryPlugin = require("./EntryPlugin");
|
const EntryPlugin = require("./EntryPlugin");
|
||||||
|
|
||||||
for (const name of Object.keys(entry)) {
|
for (const name of Object.keys(entry)) {
|
||||||
const desc = entry[name];
|
const desc = entry[name];
|
||||||
const options = EntryOptionPlugin.entryDescriptionToOptions(
|
const options = EntryOptionPlugin.entryDescriptionToOptions(
|
||||||
|
@ -81,14 +83,17 @@ class EntryOptionPlugin {
|
||||||
}
|
}
|
||||||
if (desc.chunkLoading) {
|
if (desc.chunkLoading) {
|
||||||
const EnableChunkLoadingPlugin = require("./javascript/EnableChunkLoadingPlugin");
|
const EnableChunkLoadingPlugin = require("./javascript/EnableChunkLoadingPlugin");
|
||||||
|
|
||||||
EnableChunkLoadingPlugin.checkEnabled(compiler, desc.chunkLoading);
|
EnableChunkLoadingPlugin.checkEnabled(compiler, desc.chunkLoading);
|
||||||
}
|
}
|
||||||
if (desc.wasmLoading) {
|
if (desc.wasmLoading) {
|
||||||
const EnableWasmLoadingPlugin = require("./wasm/EnableWasmLoadingPlugin");
|
const EnableWasmLoadingPlugin = require("./wasm/EnableWasmLoadingPlugin");
|
||||||
|
|
||||||
EnableWasmLoadingPlugin.checkEnabled(compiler, desc.wasmLoading);
|
EnableWasmLoadingPlugin.checkEnabled(compiler, desc.wasmLoading);
|
||||||
}
|
}
|
||||||
if (desc.library) {
|
if (desc.library) {
|
||||||
const EnableLibraryPlugin = require("./library/EnableLibraryPlugin");
|
const EnableLibraryPlugin = require("./library/EnableLibraryPlugin");
|
||||||
|
|
||||||
EnableLibraryPlugin.checkEnabled(compiler, desc.library.type);
|
EnableLibraryPlugin.checkEnabled(compiler, desc.library.type);
|
||||||
}
|
}
|
||||||
return options;
|
return options;
|
||||||
|
|
|
@ -159,8 +159,9 @@ class ExportsInfo {
|
||||||
* @returns {ExportInfo} the export info of unlisted exports
|
* @returns {ExportInfo} the export info of unlisted exports
|
||||||
*/
|
*/
|
||||||
get otherExportsInfo() {
|
get otherExportsInfo() {
|
||||||
if (this._redirectTo !== undefined)
|
if (this._redirectTo !== undefined) {
|
||||||
return this._redirectTo.otherExportsInfo;
|
return this._redirectTo.otherExportsInfo;
|
||||||
|
}
|
||||||
return this._otherExportsInfo;
|
return this._otherExportsInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,8 +260,9 @@ class ExportsInfo {
|
||||||
getExportInfo(name) {
|
getExportInfo(name) {
|
||||||
const info = this._exports.get(name);
|
const info = this._exports.get(name);
|
||||||
if (info !== undefined) return info;
|
if (info !== undefined) return info;
|
||||||
if (this._redirectTo !== undefined)
|
if (this._redirectTo !== undefined) {
|
||||||
return this._redirectTo.getExportInfo(name);
|
return this._redirectTo.getExportInfo(name);
|
||||||
|
}
|
||||||
const newInfo = new ExportInfo(name, this._otherExportsInfo);
|
const newInfo = new ExportInfo(name, this._otherExportsInfo);
|
||||||
this._exports.set(name, newInfo);
|
this._exports.set(name, newInfo);
|
||||||
this._exportsAreOrdered = false;
|
this._exportsAreOrdered = false;
|
||||||
|
@ -274,8 +276,9 @@ class ExportsInfo {
|
||||||
getReadOnlyExportInfo(name) {
|
getReadOnlyExportInfo(name) {
|
||||||
const info = this._exports.get(name);
|
const info = this._exports.get(name);
|
||||||
if (info !== undefined) return info;
|
if (info !== undefined) return info;
|
||||||
if (this._redirectTo !== undefined)
|
if (this._redirectTo !== undefined) {
|
||||||
return this._redirectTo.getReadOnlyExportInfo(name);
|
return this._redirectTo.getReadOnlyExportInfo(name);
|
||||||
|
}
|
||||||
return this._otherExportsInfo;
|
return this._otherExportsInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -494,8 +497,9 @@ class ExportsInfo {
|
||||||
*/
|
*/
|
||||||
isModuleUsed(runtime) {
|
isModuleUsed(runtime) {
|
||||||
if (this.isUsed(runtime)) return true;
|
if (this.isUsed(runtime)) return true;
|
||||||
if (this._sideEffectsOnlyInfo.getUsed(runtime) !== UsageState.Unused)
|
if (this._sideEffectsOnlyInfo.getUsed(runtime) !== UsageState.Unused) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -671,9 +675,10 @@ class ExportsInfo {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (const exportInfo of this.ownedExports) {
|
for (const exportInfo of this.ownedExports) {
|
||||||
if (exportInfo.getUsed(runtimeA) !== exportInfo.getUsed(runtimeB))
|
if (exportInfo.getUsed(runtimeA) !== exportInfo.getUsed(runtimeB)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1294,8 +1299,9 @@ class ExportInfo {
|
||||||
|
|
||||||
_getMaxTarget() {
|
_getMaxTarget() {
|
||||||
if (this._maxTarget !== undefined) return this._maxTarget;
|
if (this._maxTarget !== undefined) return this._maxTarget;
|
||||||
if (/** @type {Target} */ (this._target).size <= 1)
|
if (/** @type {Target} */ (this._target).size <= 1) {
|
||||||
return (this._maxTarget = this._target);
|
return (this._maxTarget = this._target);
|
||||||
|
}
|
||||||
let maxPriority = -Infinity;
|
let maxPriority = -Infinity;
|
||||||
let minPriority = Infinity;
|
let minPriority = Infinity;
|
||||||
for (const { priority } of /** @type {Target} */ (this._target).values()) {
|
for (const { priority } of /** @type {Target} */ (this._target).values()) {
|
||||||
|
@ -1472,8 +1478,9 @@ class ExportInfo {
|
||||||
if (
|
if (
|
||||||
target.export &&
|
target.export &&
|
||||||
!equals(/** @type {ArrayLike<string>} */ (t.export), target.export)
|
!equals(/** @type {ArrayLike<string>} */ (t.export), target.export)
|
||||||
)
|
) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
result = values.next();
|
result = values.next();
|
||||||
}
|
}
|
||||||
return target;
|
return target;
|
||||||
|
@ -1521,8 +1528,9 @@ class ExportInfo {
|
||||||
* @returns {ExportsInfo} an exports info
|
* @returns {ExportsInfo} an exports info
|
||||||
*/
|
*/
|
||||||
createNestedExportsInfo() {
|
createNestedExportsInfo() {
|
||||||
if (this.exportsInfoOwned)
|
if (this.exportsInfoOwned) {
|
||||||
return /** @type {ExportsInfo} */ (this.exportsInfo);
|
return /** @type {ExportsInfo} */ (this.exportsInfo);
|
||||||
|
}
|
||||||
this.exportsInfoOwned = true;
|
this.exportsInfoOwned = true;
|
||||||
const oldExportsInfo = this.exportsInfo;
|
const oldExportsInfo = this.exportsInfo;
|
||||||
this.exportsInfo = new ExportsInfo();
|
this.exportsInfo = new ExportsInfo();
|
||||||
|
|
|
@ -352,8 +352,9 @@ const getSourceForModuleExternal = (
|
||||||
runtimeTemplate,
|
runtimeTemplate,
|
||||||
dependencyMeta
|
dependencyMeta
|
||||||
) => {
|
) => {
|
||||||
if (!Array.isArray(moduleAndSpecifiers))
|
if (!Array.isArray(moduleAndSpecifiers)) {
|
||||||
moduleAndSpecifiers = [moduleAndSpecifiers];
|
moduleAndSpecifiers = [moduleAndSpecifiers];
|
||||||
|
}
|
||||||
const initFragment = new ModuleExternalInitFragment(
|
const initFragment = new ModuleExternalInitFragment(
|
||||||
moduleAndSpecifiers[0],
|
moduleAndSpecifiers[0],
|
||||||
undefined,
|
undefined,
|
||||||
|
@ -683,8 +684,9 @@ class ExternalModule extends Module {
|
||||||
|
|
||||||
_getRequestAndExternalType() {
|
_getRequestAndExternalType() {
|
||||||
let { request, externalType } = this;
|
let { request, externalType } = this;
|
||||||
if (typeof request === "object" && !Array.isArray(request))
|
if (typeof request === "object" && !Array.isArray(request)) {
|
||||||
request = request[externalType];
|
request = request[externalType];
|
||||||
|
}
|
||||||
externalType = this._resolveExternalType(externalType);
|
externalType = this._resolveExternalType(externalType);
|
||||||
return { request, externalType };
|
return { request, externalType };
|
||||||
}
|
}
|
||||||
|
@ -900,8 +902,9 @@ class ExternalModule extends Module {
|
||||||
);
|
);
|
||||||
|
|
||||||
let sourceString = sourceData.expression;
|
let sourceString = sourceData.expression;
|
||||||
if (sourceData.iife)
|
if (sourceData.iife) {
|
||||||
sourceString = `(function() { return ${sourceString}; }())`;
|
sourceString = `(function() { return ${sourceString}; }())`;
|
||||||
|
}
|
||||||
if (concatenationScope) {
|
if (concatenationScope) {
|
||||||
sourceString = `${
|
sourceString = `${
|
||||||
runtimeTemplate.supportsConst() ? "const" : "var"
|
runtimeTemplate.supportsConst() ? "const" : "var"
|
||||||
|
@ -912,8 +915,9 @@ class ExternalModule extends Module {
|
||||||
} else {
|
} else {
|
||||||
sourceString = `module.exports = ${sourceString};`;
|
sourceString = `module.exports = ${sourceString};`;
|
||||||
}
|
}
|
||||||
if (sourceData.init)
|
if (sourceData.init) {
|
||||||
sourceString = `${sourceData.init}\n${sourceString}`;
|
sourceString = `${sourceData.init}\n${sourceString}`;
|
||||||
|
}
|
||||||
|
|
||||||
let data;
|
let data;
|
||||||
if (sourceData.chunkInitFragments) {
|
if (sourceData.chunkInitFragments) {
|
||||||
|
|
|
@ -337,4 +337,5 @@ class ExternalModuleFactoryPlugin {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = ExternalModuleFactoryPlugin;
|
module.exports = ExternalModuleFactoryPlugin;
|
||||||
|
|
|
@ -313,7 +313,7 @@ class Snapshot {
|
||||||
* @param {number} value start value
|
* @param {number} value start value
|
||||||
*/
|
*/
|
||||||
setStartTime(value) {
|
setStartTime(value) {
|
||||||
this._flags = this._flags | 1;
|
this._flags |= 1;
|
||||||
this.startTime = value;
|
this.startTime = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -350,7 +350,7 @@ class Snapshot {
|
||||||
* @param {FileTimestamps} value file timestamps
|
* @param {FileTimestamps} value file timestamps
|
||||||
*/
|
*/
|
||||||
setFileTimestamps(value) {
|
setFileTimestamps(value) {
|
||||||
this._flags = this._flags | 2;
|
this._flags |= 2;
|
||||||
this.fileTimestamps = value;
|
this.fileTimestamps = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -362,7 +362,7 @@ class Snapshot {
|
||||||
* @param {FileHashes} value file hashes
|
* @param {FileHashes} value file hashes
|
||||||
*/
|
*/
|
||||||
setFileHashes(value) {
|
setFileHashes(value) {
|
||||||
this._flags = this._flags | 4;
|
this._flags |= 4;
|
||||||
this.fileHashes = value;
|
this.fileHashes = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -374,7 +374,7 @@ class Snapshot {
|
||||||
* @param {FileTshs} value file tshs
|
* @param {FileTshs} value file tshs
|
||||||
*/
|
*/
|
||||||
setFileTshs(value) {
|
setFileTshs(value) {
|
||||||
this._flags = this._flags | 8;
|
this._flags |= 8;
|
||||||
this.fileTshs = value;
|
this.fileTshs = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -386,7 +386,7 @@ class Snapshot {
|
||||||
* @param {ContextTimestamps} value context timestamps
|
* @param {ContextTimestamps} value context timestamps
|
||||||
*/
|
*/
|
||||||
setContextTimestamps(value) {
|
setContextTimestamps(value) {
|
||||||
this._flags = this._flags | 0x10;
|
this._flags |= 0x10;
|
||||||
this.contextTimestamps = value;
|
this.contextTimestamps = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -398,7 +398,7 @@ class Snapshot {
|
||||||
* @param {ContextHashes} value context hashes
|
* @param {ContextHashes} value context hashes
|
||||||
*/
|
*/
|
||||||
setContextHashes(value) {
|
setContextHashes(value) {
|
||||||
this._flags = this._flags | 0x20;
|
this._flags |= 0x20;
|
||||||
this.contextHashes = value;
|
this.contextHashes = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -410,7 +410,7 @@ class Snapshot {
|
||||||
* @param {ContextTshs} value context tshs
|
* @param {ContextTshs} value context tshs
|
||||||
*/
|
*/
|
||||||
setContextTshs(value) {
|
setContextTshs(value) {
|
||||||
this._flags = this._flags | 0x40;
|
this._flags |= 0x40;
|
||||||
this.contextTshs = value;
|
this.contextTshs = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -422,7 +422,7 @@ class Snapshot {
|
||||||
* @param {MissingExistence} value context tshs
|
* @param {MissingExistence} value context tshs
|
||||||
*/
|
*/
|
||||||
setMissingExistence(value) {
|
setMissingExistence(value) {
|
||||||
this._flags = this._flags | 0x80;
|
this._flags |= 0x80;
|
||||||
this.missingExistence = value;
|
this.missingExistence = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -434,7 +434,7 @@ class Snapshot {
|
||||||
* @param {ManagedItemInfo} value managed item info
|
* @param {ManagedItemInfo} value managed item info
|
||||||
*/
|
*/
|
||||||
setManagedItemInfo(value) {
|
setManagedItemInfo(value) {
|
||||||
this._flags = this._flags | 0x100;
|
this._flags |= 0x100;
|
||||||
this.managedItemInfo = value;
|
this.managedItemInfo = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -446,7 +446,7 @@ class Snapshot {
|
||||||
* @param {ManagedFiles} value managed files
|
* @param {ManagedFiles} value managed files
|
||||||
*/
|
*/
|
||||||
setManagedFiles(value) {
|
setManagedFiles(value) {
|
||||||
this._flags = this._flags | 0x200;
|
this._flags |= 0x200;
|
||||||
this.managedFiles = value;
|
this.managedFiles = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -458,7 +458,7 @@ class Snapshot {
|
||||||
* @param {ManagedContexts} value managed contexts
|
* @param {ManagedContexts} value managed contexts
|
||||||
*/
|
*/
|
||||||
setManagedContexts(value) {
|
setManagedContexts(value) {
|
||||||
this._flags = this._flags | 0x400;
|
this._flags |= 0x400;
|
||||||
this.managedContexts = value;
|
this.managedContexts = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -470,7 +470,7 @@ class Snapshot {
|
||||||
* @param {ManagedMissing} value managed missing
|
* @param {ManagedMissing} value managed missing
|
||||||
*/
|
*/
|
||||||
setManagedMissing(value) {
|
setManagedMissing(value) {
|
||||||
this._flags = this._flags | 0x800;
|
this._flags |= 0x800;
|
||||||
this.managedMissing = value;
|
this.managedMissing = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -482,7 +482,7 @@ class Snapshot {
|
||||||
* @param {Children} value children
|
* @param {Children} value children
|
||||||
*/
|
*/
|
||||||
setChildren(value) {
|
setChildren(value) {
|
||||||
this._flags = this._flags | 0x1000;
|
this._flags |= 0x1000;
|
||||||
this.children = value;
|
this.children = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -792,8 +792,9 @@ class SnapshotOptimization {
|
||||||
snapshotContent: new Set(commonMap.keys()),
|
snapshotContent: new Set(commonMap.keys()),
|
||||||
children: undefined
|
children: undefined
|
||||||
};
|
};
|
||||||
if (optimizationEntry.children === undefined)
|
if (optimizationEntry.children === undefined) {
|
||||||
optimizationEntry.children = new Set();
|
optimizationEntry.children = new Set();
|
||||||
|
}
|
||||||
optimizationEntry.children.add(newEntry);
|
optimizationEntry.children.add(newEntry);
|
||||||
storeOptimizationEntry(newEntry);
|
storeOptimizationEntry(newEntry);
|
||||||
this._statSharedSnapshots++;
|
this._statSharedSnapshots++;
|
||||||
|
@ -872,8 +873,9 @@ class SnapshotOptimization {
|
||||||
* @returns {string} result
|
* @returns {string} result
|
||||||
*/
|
*/
|
||||||
const parseString = str => {
|
const parseString = str => {
|
||||||
if (str[0] === "'" || str[0] === "`")
|
if (str[0] === "'" || str[0] === "`") {
|
||||||
str = `"${str.slice(1, -1).replace(/"/g, '\\"')}"`;
|
str = `"${str.slice(1, -1).replace(/"/g, '\\"')}"`;
|
||||||
|
}
|
||||||
return JSON.parse(str);
|
return JSON.parse(str);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1475,16 +1477,18 @@ class FileSystemInfo {
|
||||||
const cache = this._contextHashes.get(path);
|
const cache = this._contextHashes.get(path);
|
||||||
if (cache !== undefined) {
|
if (cache !== undefined) {
|
||||||
const resolved = getResolvedHash(cache);
|
const resolved = getResolvedHash(cache);
|
||||||
if (resolved !== undefined)
|
if (resolved !== undefined) {
|
||||||
return callback(null, /** @type {string} */ (resolved));
|
return callback(null, /** @type {string} */ (resolved));
|
||||||
|
}
|
||||||
return this._resolveContextHash(cache, callback);
|
return this._resolveContextHash(cache, callback);
|
||||||
}
|
}
|
||||||
this.contextHashQueue.add(path, (err, _entry) => {
|
this.contextHashQueue.add(path, (err, _entry) => {
|
||||||
if (err) return callback(err);
|
if (err) return callback(err);
|
||||||
const entry = /** @type {ContextHash} */ (_entry);
|
const entry = /** @type {ContextHash} */ (_entry);
|
||||||
const resolved = getResolvedHash(entry);
|
const resolved = getResolvedHash(entry);
|
||||||
if (resolved !== undefined)
|
if (resolved !== undefined) {
|
||||||
return callback(null, /** @type {string} */ (resolved));
|
return callback(null, /** @type {string} */ (resolved));
|
||||||
|
}
|
||||||
this._resolveContextHash(entry, callback);
|
this._resolveContextHash(entry, callback);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1893,8 +1897,9 @@ class FileSystemInfo {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
let request = subPath.replace(/\\/g, "/");
|
let request = subPath.replace(/\\/g, "/");
|
||||||
if (request.endsWith(".js"))
|
if (request.endsWith(".js")) {
|
||||||
request = request.slice(0, -3);
|
request = request.slice(0, -3);
|
||||||
|
}
|
||||||
push({
|
push({
|
||||||
type: RBDT_RESOLVE_CJS_FILE_AS_CHILD,
|
type: RBDT_RESOLVE_CJS_FILE_AS_CHILD,
|
||||||
context,
|
context,
|
||||||
|
@ -1929,7 +1934,9 @@ class FileSystemInfo {
|
||||||
);
|
);
|
||||||
this._warnAboutExperimentalEsmTracking = true;
|
this._warnAboutExperimentalEsmTracking = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const lexer = require("es-module-lexer");
|
const lexer = require("es-module-lexer");
|
||||||
|
|
||||||
lexer.init.then(() => {
|
lexer.init.then(() => {
|
||||||
this.fs.readFile(path, (err, content) => {
|
this.fs.readFile(path, (err, content) => {
|
||||||
if (err) return callback(err);
|
if (err) return callback(err);
|
||||||
|
@ -2025,7 +2032,8 @@ class FileSystemInfo {
|
||||||
let packageData;
|
let packageData;
|
||||||
try {
|
try {
|
||||||
packageData = JSON.parse(
|
packageData = JSON.parse(
|
||||||
/** @type {Buffer} */ (content).toString("utf-8")
|
/** @type {Buffer} */
|
||||||
|
(content).toString("utf8")
|
||||||
);
|
);
|
||||||
} catch (parseErr) {
|
} catch (parseErr) {
|
||||||
return callback(/** @type {Error} */ (parseErr));
|
return callback(/** @type {Error} */ (parseErr));
|
||||||
|
@ -2099,8 +2107,9 @@ class FileSystemInfo {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "d":
|
case "d":
|
||||||
resolveContext(context, path, {}, (err, _, result) => {
|
resolveContext(context, path, {}, (err, _, result) => {
|
||||||
if (expectedResult === false)
|
if (expectedResult === false) {
|
||||||
return callback(err ? undefined : INVALID);
|
return callback(err ? undefined : INVALID);
|
||||||
|
}
|
||||||
if (err) return callback(err);
|
if (err) return callback(err);
|
||||||
const resultPath = /** @type {ResolveRequest} */ (result).path;
|
const resultPath = /** @type {ResolveRequest} */ (result).path;
|
||||||
if (resultPath !== expectedResult) return callback(INVALID);
|
if (resultPath !== expectedResult) return callback(INVALID);
|
||||||
|
@ -2109,8 +2118,9 @@ class FileSystemInfo {
|
||||||
break;
|
break;
|
||||||
case "f":
|
case "f":
|
||||||
resolveCjs(context, path, {}, (err, _, result) => {
|
resolveCjs(context, path, {}, (err, _, result) => {
|
||||||
if (expectedResult === false)
|
if (expectedResult === false) {
|
||||||
return callback(err ? undefined : INVALID);
|
return callback(err ? undefined : INVALID);
|
||||||
|
}
|
||||||
if (err) return callback(err);
|
if (err) return callback(err);
|
||||||
const resultPath = /** @type {ResolveRequest} */ (result).path;
|
const resultPath = /** @type {ResolveRequest} */ (result).path;
|
||||||
if (resultPath !== expectedResult) return callback(INVALID);
|
if (resultPath !== expectedResult) return callback(INVALID);
|
||||||
|
@ -2119,8 +2129,9 @@ class FileSystemInfo {
|
||||||
break;
|
break;
|
||||||
case "c":
|
case "c":
|
||||||
resolveCjsAsChild(context, path, {}, (err, _, result) => {
|
resolveCjsAsChild(context, path, {}, (err, _, result) => {
|
||||||
if (expectedResult === false)
|
if (expectedResult === false) {
|
||||||
return callback(err ? undefined : INVALID);
|
return callback(err ? undefined : INVALID);
|
||||||
|
}
|
||||||
if (err) return callback(err);
|
if (err) return callback(err);
|
||||||
const resultPath = /** @type {ResolveRequest} */ (result).path;
|
const resultPath = /** @type {ResolveRequest} */ (result).path;
|
||||||
if (resultPath !== expectedResult) return callback(INVALID);
|
if (resultPath !== expectedResult) return callback(INVALID);
|
||||||
|
@ -2129,8 +2140,9 @@ class FileSystemInfo {
|
||||||
break;
|
break;
|
||||||
case "e":
|
case "e":
|
||||||
resolveEsm(context, path, {}, (err, _, result) => {
|
resolveEsm(context, path, {}, (err, _, result) => {
|
||||||
if (expectedResult === false)
|
if (expectedResult === false) {
|
||||||
return callback(err ? undefined : INVALID);
|
return callback(err ? undefined : INVALID);
|
||||||
|
}
|
||||||
if (err) return callback(err);
|
if (err) return callback(err);
|
||||||
const resultPath = /** @type {ResolveRequest} */ (result).path;
|
const resultPath = /** @type {ResolveRequest} */ (result).path;
|
||||||
if (resultPath !== expectedResult) return callback(INVALID);
|
if (resultPath !== expectedResult) return callback(INVALID);
|
||||||
|
@ -3515,8 +3527,9 @@ class FileSystemInfo {
|
||||||
fromFile: (file, stat, callback) => {
|
fromFile: (file, stat, callback) => {
|
||||||
// Prefer the cached value over our new stat to report consistent results
|
// Prefer the cached value over our new stat to report consistent results
|
||||||
const cache = this._fileTimestamps.get(file);
|
const cache = this._fileTimestamps.get(file);
|
||||||
if (cache !== undefined)
|
if (cache !== undefined) {
|
||||||
return callback(null, cache === "ignore" ? null : cache);
|
return callback(null, cache === "ignore" ? null : cache);
|
||||||
|
}
|
||||||
|
|
||||||
const mtime = Number(stat.mtime);
|
const mtime = Number(stat.mtime);
|
||||||
|
|
||||||
|
@ -4029,7 +4042,7 @@ class FileSystemInfo {
|
||||||
}
|
}
|
||||||
let data;
|
let data;
|
||||||
try {
|
try {
|
||||||
data = JSON.parse(/** @type {Buffer} */ (content).toString("utf-8"));
|
data = JSON.parse(/** @type {Buffer} */ (content).toString("utf8"));
|
||||||
} catch (parseErr) {
|
} catch (parseErr) {
|
||||||
return callback(/** @type {WebpackError} */ (parseErr));
|
return callback(/** @type {WebpackError} */ (parseErr));
|
||||||
}
|
}
|
||||||
|
@ -4048,8 +4061,9 @@ class FileSystemInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
getDeprecatedFileTimestamps() {
|
getDeprecatedFileTimestamps() {
|
||||||
if (this._cachedDeprecatedFileTimestamps !== undefined)
|
if (this._cachedDeprecatedFileTimestamps !== undefined) {
|
||||||
return this._cachedDeprecatedFileTimestamps;
|
return this._cachedDeprecatedFileTimestamps;
|
||||||
|
}
|
||||||
/** @type {Map<string, number | null>} */
|
/** @type {Map<string, number | null>} */
|
||||||
const map = new Map();
|
const map = new Map();
|
||||||
for (const [path, info] of this._fileTimestamps) {
|
for (const [path, info] of this._fileTimestamps) {
|
||||||
|
@ -4059,8 +4073,9 @@ class FileSystemInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
getDeprecatedContextTimestamps() {
|
getDeprecatedContextTimestamps() {
|
||||||
if (this._cachedDeprecatedContextTimestamps !== undefined)
|
if (this._cachedDeprecatedContextTimestamps !== undefined) {
|
||||||
return this._cachedDeprecatedContextTimestamps;
|
return this._cachedDeprecatedContextTimestamps;
|
||||||
|
}
|
||||||
/** @type {Map<string, number | null>} */
|
/** @type {Map<string, number | null>} */
|
||||||
const map = new Map();
|
const map = new Map();
|
||||||
for (const [path, info] of this._contextTimestamps) {
|
for (const [path, info] of this._contextTimestamps) {
|
||||||
|
|
|
@ -200,21 +200,28 @@ class FlagDependencyExportsPlugin {
|
||||||
name = exportNameOrSpec;
|
name = exportNameOrSpec;
|
||||||
} else {
|
} else {
|
||||||
name = exportNameOrSpec.name;
|
name = exportNameOrSpec.name;
|
||||||
if (exportNameOrSpec.canMangle !== undefined)
|
if (exportNameOrSpec.canMangle !== undefined) {
|
||||||
canMangle = exportNameOrSpec.canMangle;
|
canMangle = exportNameOrSpec.canMangle;
|
||||||
if (exportNameOrSpec.export !== undefined)
|
}
|
||||||
|
if (exportNameOrSpec.export !== undefined) {
|
||||||
fromExport = exportNameOrSpec.export;
|
fromExport = exportNameOrSpec.export;
|
||||||
if (exportNameOrSpec.exports !== undefined)
|
}
|
||||||
|
if (exportNameOrSpec.exports !== undefined) {
|
||||||
exports = exportNameOrSpec.exports;
|
exports = exportNameOrSpec.exports;
|
||||||
if (exportNameOrSpec.from !== undefined)
|
}
|
||||||
|
if (exportNameOrSpec.from !== undefined) {
|
||||||
from = exportNameOrSpec.from;
|
from = exportNameOrSpec.from;
|
||||||
if (exportNameOrSpec.priority !== undefined)
|
}
|
||||||
|
if (exportNameOrSpec.priority !== undefined) {
|
||||||
priority = exportNameOrSpec.priority;
|
priority = exportNameOrSpec.priority;
|
||||||
if (exportNameOrSpec.terminalBinding !== undefined)
|
}
|
||||||
|
if (exportNameOrSpec.terminalBinding !== undefined) {
|
||||||
terminalBinding = exportNameOrSpec.terminalBinding;
|
terminalBinding = exportNameOrSpec.terminalBinding;
|
||||||
if (exportNameOrSpec.hidden !== undefined)
|
}
|
||||||
|
if (exportNameOrSpec.hidden !== undefined) {
|
||||||
hidden = exportNameOrSpec.hidden;
|
hidden = exportNameOrSpec.hidden;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
const exportInfo = exportsInfo.getExportInfo(name);
|
const exportInfo = exportsInfo.getExportInfo(name);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
|
|
@ -68,6 +68,7 @@ class Generator {
|
||||||
*/
|
*/
|
||||||
getTypes(module) {
|
getTypes(module) {
|
||||||
const AbstractMethodError = require("./AbstractMethodError");
|
const AbstractMethodError = require("./AbstractMethodError");
|
||||||
|
|
||||||
throw new AbstractMethodError();
|
throw new AbstractMethodError();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,6 +81,7 @@ class Generator {
|
||||||
*/
|
*/
|
||||||
getSize(module, type) {
|
getSize(module, type) {
|
||||||
const AbstractMethodError = require("./AbstractMethodError");
|
const AbstractMethodError = require("./AbstractMethodError");
|
||||||
|
|
||||||
throw new AbstractMethodError();
|
throw new AbstractMethodError();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,6 +97,7 @@ class Generator {
|
||||||
{ dependencyTemplates, runtimeTemplate, moduleGraph, type }
|
{ dependencyTemplates, runtimeTemplate, moduleGraph, type }
|
||||||
) {
|
) {
|
||||||
const AbstractMethodError = require("./AbstractMethodError");
|
const AbstractMethodError = require("./AbstractMethodError");
|
||||||
|
|
||||||
throw new AbstractMethodError();
|
throw new AbstractMethodError();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,7 @@ const makeWebpackError = (error, hook) => {
|
||||||
if (error instanceof WebpackError) return error;
|
if (error instanceof WebpackError) return error;
|
||||||
return new HookWebpackError(error, hook);
|
return new HookWebpackError(error, hook);
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.makeWebpackError = makeWebpackError;
|
module.exports.makeWebpackError = makeWebpackError;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -110,8 +110,9 @@ class HotModuleReplacementPlugin {
|
||||||
*/
|
*/
|
||||||
apply(compiler) {
|
apply(compiler) {
|
||||||
const { _backCompat: backCompat } = compiler;
|
const { _backCompat: backCompat } = compiler;
|
||||||
if (compiler.options.output.strictModuleErrorHandling === undefined)
|
if (compiler.options.output.strictModuleErrorHandling === undefined) {
|
||||||
compiler.options.output.strictModuleErrorHandling = true;
|
compiler.options.output.strictModuleErrorHandling = true;
|
||||||
|
}
|
||||||
const runtimeRequirements = [RuntimeGlobals.module];
|
const runtimeRequirements = [RuntimeGlobals.module];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -677,9 +678,10 @@ class HotModuleReplacementPlugin {
|
||||||
} else if (
|
} else if (
|
||||||
moduleRuntime !== undefined &&
|
moduleRuntime !== undefined &&
|
||||||
moduleRuntime.has(/** @type {string} */ (runtime))
|
moduleRuntime.has(/** @type {string} */ (runtime))
|
||||||
)
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
const item =
|
const item =
|
||||||
/** @type {HotUpdateMainContentByRuntimeItem} */ (
|
/** @type {HotUpdateMainContentByRuntimeItem} */ (
|
||||||
hotUpdateMainContentByRuntime.get(
|
hotUpdateMainContentByRuntime.get(
|
||||||
|
@ -696,16 +698,18 @@ class HotModuleReplacementPlugin {
|
||||||
(newRuntimeModules && newRuntimeModules.length > 0)
|
(newRuntimeModules && newRuntimeModules.length > 0)
|
||||||
) {
|
) {
|
||||||
const hotUpdateChunk = new HotUpdateChunk();
|
const hotUpdateChunk = new HotUpdateChunk();
|
||||||
if (backCompat)
|
if (backCompat) {
|
||||||
ChunkGraph.setChunkGraphForChunk(hotUpdateChunk, chunkGraph);
|
ChunkGraph.setChunkGraphForChunk(hotUpdateChunk, chunkGraph);
|
||||||
|
}
|
||||||
hotUpdateChunk.id = chunkId;
|
hotUpdateChunk.id = chunkId;
|
||||||
hotUpdateChunk.runtime = currentChunk
|
hotUpdateChunk.runtime = currentChunk
|
||||||
? currentChunk.runtime
|
? currentChunk.runtime
|
||||||
: newRuntime;
|
: newRuntime;
|
||||||
if (currentChunk) {
|
if (currentChunk) {
|
||||||
for (const group of currentChunk.groupsIterable)
|
for (const group of currentChunk.groupsIterable) {
|
||||||
hotUpdateChunk.addGroup(group);
|
hotUpdateChunk.addGroup(group);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
chunkGraph.attachModules(hotUpdateChunk, newModules || []);
|
chunkGraph.attachModules(hotUpdateChunk, newModules || []);
|
||||||
chunkGraph.attachRuntimeModules(
|
chunkGraph.attachRuntimeModules(
|
||||||
hotUpdateChunk,
|
hotUpdateChunk,
|
||||||
|
@ -796,12 +800,15 @@ The configured output.hotUpdateMainFilename doesn't lead to unique filenames per
|
||||||
This might lead to incorrect runtime behavior of the applied update.
|
This might lead to incorrect runtime behavior of the applied update.
|
||||||
To fix this, make sure to include [runtime] in the output.hotUpdateMainFilename option, or use the default config.`)
|
To fix this, make sure to include [runtime] in the output.hotUpdateMainFilename option, or use the default config.`)
|
||||||
);
|
);
|
||||||
for (const chunkId of removedChunkIds)
|
for (const chunkId of removedChunkIds) {
|
||||||
old.removedChunkIds.add(chunkId);
|
old.removedChunkIds.add(chunkId);
|
||||||
for (const chunkId of removedModules)
|
}
|
||||||
|
for (const chunkId of removedModules) {
|
||||||
old.removedModules.add(chunkId);
|
old.removedModules.add(chunkId);
|
||||||
for (const chunkId of updatedChunkIds)
|
}
|
||||||
|
for (const chunkId of updatedChunkIds) {
|
||||||
old.updatedChunkIds.add(chunkId);
|
old.updatedChunkIds.add(chunkId);
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
hotUpdateMainContentByFilename.set(filename, {
|
hotUpdateMainContentByFilename.set(filename, {
|
||||||
|
|
|
@ -14,7 +14,7 @@ const createSchemaValidation = require("./util/create-schema-validation");
|
||||||
/** @typedef {import("./NormalModuleFactory").ResolveData} ResolveData */
|
/** @typedef {import("./NormalModuleFactory").ResolveData} ResolveData */
|
||||||
|
|
||||||
const validate = createSchemaValidation(
|
const validate = createSchemaValidation(
|
||||||
require("../schemas/plugins/IgnorePlugin.check.js"),
|
require("../schemas/plugins/IgnorePlugin.check"),
|
||||||
() => require("../schemas/plugins/IgnorePlugin.json"),
|
() => require("../schemas/plugins/IgnorePlugin.json"),
|
||||||
{
|
{
|
||||||
name: "Ignore Plugin",
|
name: "Ignore Plugin",
|
||||||
|
|
|
@ -140,4 +140,5 @@ class LibManifestPlugin {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = LibManifestPlugin;
|
module.exports = LibManifestPlugin;
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue