remove weird types

remove SKIP_OVER_NAME
update tooling for fixed "to not edit" comments
This commit is contained in:
Tobias Koppers 2020-05-12 15:58:14 +02:00
parent 31ff4b99d6
commit 020cedf383
31 changed files with 47 additions and 120 deletions

View File

@ -1,4 +1,4 @@
/**
/*
* This file was automatically generated.
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update

View File

@ -1,4 +1,4 @@
/**
/*
* This file was automatically generated.
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update

View File

@ -1,4 +1,4 @@
/**
/*
* This file was automatically generated.
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update

View File

@ -1,4 +1,4 @@
/**
/*
* This file was automatically generated.
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update

View File

@ -1,4 +1,4 @@
/**
/*
* This file was automatically generated.
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update

View File

@ -1,4 +1,4 @@
/**
/*
* This file was automatically generated.
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update

View File

@ -1,4 +1,4 @@
/**
/*
* This file was automatically generated.
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update

View File

@ -1,4 +1,4 @@
/**
/*
* This file was automatically generated.
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update

View File

@ -1,4 +1,4 @@
/**
/*
* This file was automatically generated.
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update

View File

@ -1,4 +1,4 @@
/**
/*
* This file was automatically generated.
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update

View File

@ -1,4 +1,4 @@
/**
/*
* This file was automatically generated.
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update

View File

@ -1,4 +1,4 @@
/**
/*
* This file was automatically generated.
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update

View File

@ -1,4 +1,4 @@
/**
/*
* This file was automatically generated.
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update

View File

@ -1,4 +1,4 @@
/**
/*
* This file was automatically generated.
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update

View File

@ -1,4 +1,4 @@
/**
/*
* This file was automatically generated.
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update

View File

@ -1,4 +1,4 @@
/**
/*
* This file was automatically generated.
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update

View File

@ -1,4 +1,4 @@
/**
/*
* This file was automatically generated.
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update

View File

@ -1,4 +1,4 @@
/**
/*
* This file was automatically generated.
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update

View File

@ -1,4 +1,4 @@
/**
/*
* This file was automatically generated.
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update

View File

@ -1,4 +1,4 @@
/**
/*
* This file was automatically generated.
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update

View File

@ -1,4 +1,4 @@
/**
/*
* This file was automatically generated.
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update

View File

@ -1,4 +1,4 @@
/**
/*
* This file was automatically generated.
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update

View File

@ -1,4 +1,4 @@
/**
/*
* This file was automatically generated.
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update

View File

@ -20,12 +20,11 @@ function createMessage(method) {
* @constructor
*/
function Message() {
/** @type {string} */
this.stack = undefined;
Error.captureStackTrace(this);
/** @type {RegExpMatchArray} */
const match = /** @type {*} */ (this.stack)
.split("\n")[3]
.match(CURRENT_METHOD_REGEXP);
const match = this.stack.split("\n")[3].match(CURRENT_METHOD_REGEXP);
this.message = match && match[1] ? createMessage(match[1]) : createMessage();
}

View File

@ -7,6 +7,7 @@
const { OriginalSource, RawSource } = require("webpack-sources");
const AsyncDependenciesBlock = require("./AsyncDependenciesBlock");
const { makeWebpackError } = require("./HookWebpackError");
const Module = require("./Module");
const RuntimeGlobals = require("./RuntimeGlobals");
const Template = require("./Template");
@ -64,7 +65,7 @@ const makeSerializable = require("./util/makeSerializable");
/**
* @callback ResolveDependenciesCallback
* @param {WebpackError=} err
* @param {Error=} err
* @param {ContextElementDependency[]} dependencies
*/
@ -330,7 +331,11 @@ class ContextModule extends Module {
this.blocks.length = 0;
const startTime = Date.now();
this.resolveDependencies(fs, this.options, (err, dependencies) => {
if (err) return callback(err);
if (err) {
return callback(
makeWebpackError(err, "ContextModule.resolveDependencies")
);
}
// abort if something failed
// this will create an empty context

View File

@ -34,11 +34,11 @@ const getJavascriptModulesPlugin = memorize(() =>
class MainTemplate {
/**
*
* @param {TODO|undefined} outputOptions output options for the MainTemplate
* @param {TODO} outputOptions output options for the MainTemplate
* @param {Compilation} compilation the compilation
*/
constructor(outputOptions, compilation) {
/** @type {TODO|undefined} */
/** @type {TODO} */
this._outputOptions = outputOptions || {};
this.hooks = Object.freeze({
renderManifest: {

View File

@ -628,12 +628,8 @@ class Module extends DependenciesBlock {
const exportsInfo = chunkGraph.moduleGraph.getExportsInfo(this);
for (const exportInfo of exportsInfo.orderedExports) {
hash.update(exportInfo.name);
hash.update(exportInfo.used + "");
hash.update(
exportInfo.usedName === ModuleGraph.SKIP_OVER_NAME
? "<skip-over-name>"
: exportInfo.usedName + ""
);
hash.update(`${exportInfo.used}`);
hash.update(`${exportInfo.usedName}`);
}
if (this.presentationalDependencies !== undefined) {
for (const dep of this.presentationalDependencies) {

View File

@ -24,8 +24,6 @@ const makeSerializable = require("./util/makeSerializable");
const EMPTY_ARRAY = [];
const SKIP_OVER_NAME = Symbol("skip over name");
/** @typedef {0|1|2|3|4} UsageStateType */
const UsageState = Object.freeze({
@ -491,12 +489,7 @@ class ExportsInfo {
let info = this.getReadOnlyExportInfo(name[0]);
const x = info.getUsedName(name[0]);
if (x === false) return false;
const arr =
x === name[0] && name.length === 1
? name
: x !== SKIP_OVER_NAME
? [x]
: EMPTY_ARRAY;
const arr = x === name[0] && name.length === 1 ? name : [x];
if (name.length === 1) {
return arr;
}
@ -510,7 +503,6 @@ class ExportsInfo {
} else {
let info = this.getReadOnlyExportInfo(name);
const usedName = info.getUsedName(name);
if (usedName === SKIP_OVER_NAME) return "";
return usedName;
}
}
@ -569,7 +561,7 @@ class ExportInfo {
constructor(name, initFrom) {
/** @type {string} */
this.name = name;
/** @type {string | null | SKIP_OVER_NAME} */
/** @type {string | null} */
this.usedName = initFrom ? initFrom.usedName : null;
/** @type {UsageStateType} */
this.used = initFrom ? initFrom.used : UsageState.NoInfo;
@ -625,7 +617,7 @@ class ExportInfo {
/**
* get used name
* @param {string=} fallbackName fallback name for used exports with no name
* @returns {string | false | SKIP_OVER_NAME} used name
* @returns {string | false} used name
*/
getUsedName(fallbackName) {
if (this.used === UsageState.Unused) return false;
@ -675,9 +667,7 @@ class ExportInfo {
getRenameInfo() {
if (this.usedName !== null && this.usedName !== this.name) {
return this.usedName !== SKIP_OVER_NAME
? `renamed to ${JSON.stringify(this.usedName).slice(1, -1)}`
: "no name, virtual";
return `renamed to ${JSON.stringify(this.usedName).slice(1, -1)}`;
}
switch (this.canMangleProvide) {
case undefined:
@ -1361,5 +1351,4 @@ module.exports = ModuleGraph;
module.exports.ModuleGraphConnection = ModuleGraphConnection;
module.exports.ExportsInfo = ExportsInfo;
module.exports.ExportInfo = ExportInfo;
module.exports.SKIP_OVER_NAME = SKIP_OVER_NAME;
module.exports.UsageState = UsageState;

View File

@ -80,7 +80,7 @@
"strip-ansi": "^6.0.0",
"style-loader": "^1.0.0",
"toml": "^3.0.0",
"tooling": "webpack/tooling#v1.5.0",
"tooling": "webpack/tooling#v1.6.0",
"ts-loader": "^6.0.4",
"typescript": "3.9.2-insiders.20200509",
"url-loader": "^2.1.0",

68
types.d.ts vendored
View File

@ -1,4 +1,4 @@
/**
/*
* This file was automatically generated.
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update
@ -129,12 +129,6 @@ declare class AggressiveSplittingPlugin {
apply(compiler: Compiler): void;
static wasChunkRecorded(chunk: Chunk): boolean;
}
/**
* This file was automatically generated.
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update
*/
declare interface AggressiveSplittingPluginOptions {
/**
* Extra cost for each chunk (Default: 9.8kiB).
@ -1750,12 +1744,6 @@ declare class DllPlugin {
*/
apply(compiler: Compiler): void;
}
/**
* This file was automatically generated.
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update
*/
declare interface DllPluginOptions {
/**
* Context of requests in the manifest file (defaults to the webpack context).
@ -2146,7 +2134,7 @@ declare interface Experiments {
declare class ExportInfo {
constructor(name: string, initFrom?: ExportInfo);
name: string;
usedName: string | typeof SKIP_OVER_NAME;
usedName: string;
used: 0 | 1 | 2 | 3 | 4;
/**
@ -2177,7 +2165,7 @@ declare class ExportInfo {
/**
* get used name
*/
getUsedName(fallbackName?: string): string | false | typeof SKIP_OVER_NAME;
getUsedName(fallbackName?: string): DevTool;
createNestedExportsInfo(): ExportsInfo;
getNestedExportsInfo(): ExportsInfo;
getUsedInfo():
@ -2563,12 +2551,6 @@ declare class HashedModuleIdsPlugin {
options: HashedModuleIdsPluginOptions;
apply(compiler?: any): void;
}
/**
* This file was automatically generated.
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update
*/
declare interface HashedModuleIdsPluginOptions {
/**
* The context directory for creating names.
@ -3345,12 +3327,6 @@ declare class LimitChunkCountPlugin {
options: LimitChunkCountPluginOptions;
apply(compiler: Compiler): void;
}
/**
* This file was automatically generated.
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update
*/
declare interface LimitChunkCountPluginOptions {
/**
* Constant overhead for a chunk.
@ -3388,12 +3364,6 @@ declare class LoaderOptionsPlugin {
*/
apply(compiler: Compiler): void;
}
/**
* This file was automatically generated.
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update
*/
declare interface LoaderOptionsPluginOptions {
[index: string]: any;
@ -3549,12 +3519,6 @@ declare class MinChunkSizePlugin {
*/
apply(compiler: Compiler): void;
}
/**
* This file was automatically generated.
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update
*/
declare interface MinChunkSizePluginOptions {
/**
* Constant overhead for a chunk.
@ -3838,7 +3802,6 @@ declare class ModuleGraph {
static ModuleGraphConnection: typeof ModuleGraphConnection;
static ExportsInfo: typeof ExportsInfo;
static ExportInfo: typeof ExportInfo;
static SKIP_OVER_NAME: typeof SKIP_OVER_NAME;
static UsageState: Readonly<{
NoInfo: 0;
Unused: 1;
@ -4303,12 +4266,6 @@ declare class OccurrenceChunkIdsPlugin {
*/
apply(compiler: Compiler): void;
}
/**
* This file was automatically generated.
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update
*/
declare interface OccurrenceChunkIdsPluginOptions {
/**
* Prioritise initial size over total size.
@ -4324,12 +4281,6 @@ declare class OccurrenceModuleIdsPlugin {
*/
apply(compiler: Compiler): void;
}
/**
* This file was automatically generated.
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update
*/
declare interface OccurrenceModuleIdsPluginOptions {
/**
* Prioritise initial size over total size.
@ -5165,12 +5116,6 @@ declare class ProfilingPlugin {
apply(compiler?: any): void;
static Profiler: typeof Profiler;
}
/**
* This file was automatically generated.
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update
*/
declare interface ProfilingPluginOptions {
/**
* Path to the output file e.g. `path.resolve(__dirname, 'profiling/events.json')`. Defaults to `events.json`.
@ -6179,7 +6124,6 @@ declare abstract class RuntimeValue {
fileDependencies: any;
exec(parser?: any): any;
}
declare const SKIP_OVER_NAME: unique symbol;
declare interface ScopeInfo {
definitions: StackedMap<string, ScopeInfo | VariableInfo>;
topLevelScope: boolean | "arrow";
@ -6860,12 +6804,6 @@ declare class WatchIgnorePlugin {
*/
apply(compiler: Compiler): void;
}
/**
* This file was automatically generated.
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update
*/
declare interface WatchIgnorePluginOptions {
/**
* A list of RegExps or absolute paths to directories or files that should be ignored.

View File

@ -6744,9 +6744,9 @@ toml@^3.0.0:
resolved "https://registry.yarnpkg.com/toml/-/toml-3.0.0.tgz#342160f1af1904ec9d204d03a5d61222d762c5ee"
integrity sha512-y/mWCZinnvxjTKYhJ+pYxwD0mRLVvOtdS2Awbgxln6iEnt4rk0yBxeSBHkGJcPucRiG0e55mwWp+g/05rsrd6w==
tooling@webpack/tooling#v1.5.0:
version "1.5.0"
resolved "https://codeload.github.com/webpack/tooling/tar.gz/6e3fdd36b63a2904031fd00140aaf9bcc0911989"
tooling@webpack/tooling#v1.6.0:
version "1.6.0"
resolved "https://codeload.github.com/webpack/tooling/tar.gz/a42d42ad589daf63b30cfc4c035c4bed93f4027b"
dependencies:
"@yarnpkg/lockfile" "^1.1.0"
commondir "^1.0.1"