xhs-mp-pack 2.0.0-beta.4 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Compilation.d.ts +5 -5
- package/dist/Compilation.js +5 -5
- package/dist/Compiler.d.ts +2 -2
- package/dist/Compiler.js +3 -3
- package/dist/FileSystemInfo.js +2 -2
- package/dist/MPPack.d.ts +3 -1
- package/dist/MPPack.js +45 -15
- package/dist/MPPackSetting.d.ts +25 -7
- package/dist/MPPackSetting.js +7 -4
- package/dist/PluginManager.d.ts +1 -0
- package/dist/PluginManager.js +73 -76
- package/dist/Template.d.ts +1 -1
- package/dist/Watching.js +4 -1
- package/dist/applyDefaults.d.ts +3 -0
- package/dist/{base/defaults.js → applyDefaults.js} +104 -106
- package/dist/base/ConditionalInitFragment.js +1 -1
- package/dist/base/InitFragment.js +2 -2
- package/dist/base/LazySet.js +2 -2
- package/dist/base/StartupHelpers.js +1 -1
- package/dist/base/copyPatterns.js +22 -28
- package/dist/base/errors/BaseError.js +2 -2
- package/dist/base/errors/CommentCompilationWarning.js +2 -2
- package/dist/base/errors/ConcurrentCompilationError.js +1 -1
- package/dist/base/errors/CriticalDependencyWarning.js +2 -2
- package/dist/base/errors/ErrorHelpers.d.ts +3 -3
- package/dist/base/errors/ErrorHelpers.js +6 -6
- package/dist/base/errors/InvalidDependenciesModuleWarning.js +2 -2
- package/dist/base/errors/ModuleBuildError.js +2 -2
- package/dist/base/errors/ModuleDependencyWarning.js +2 -2
- package/dist/base/errors/ModuleError.js +2 -2
- package/dist/base/errors/ModuleParseError.js +2 -2
- package/dist/base/errors/ModuleWarning.js +2 -2
- package/dist/base/errors/NodeStuffInWebError.js +2 -2
- package/dist/base/errors/ParserError.d.ts +22 -0
- package/dist/base/errors/ParserError.js +129 -0
- package/dist/base/errors/UnhandledSchemeError.js +3 -3
- package/dist/base/errors/UnsupportedFeatureWarning.js +2 -2
- package/dist/base/logging/Logger.js +3 -3
- package/dist/base/normalization.d.ts +2 -2
- package/dist/base/normalization.js +62 -71
- package/dist/base/numberHash.d.ts +1 -1
- package/dist/base/numberHash.js +1 -1
- package/dist/base/parseTokenList.d.ts +5 -0
- package/dist/base/parseTokenList.js +37 -0
- package/dist/cache/IdleFileCachePlugin.js +4 -3
- package/dist/cache/PackFileCacheStrategy.js +9 -8
- package/dist/cache/ResolverCachePlugin.js +2 -2
- package/dist/dependencies/AsyncDependenciesBlock.js +2 -2
- package/dist/dependencies/CreateScriptUrlDependency.js +2 -2
- package/dist/dependencies/DelegatedSourceDependency.js +2 -2
- package/dist/dependencies/DependenciesBlock.js +2 -2
- package/dist/dependencies/ExportsInfoDependency.js +2 -2
- package/dist/dependencies/ModuleDependency.js +1 -1
- package/dist/dependencies/NullDependency.js +1 -1
- package/dist/dependencies/PureExpressionDependency.js +2 -2
- package/dist/dependencies/RuntimeRequirementsDependency.js +2 -2
- package/dist/dependencies/StaticExportsDependency.js +2 -2
- package/dist/dependencies/UnsupportedDependency.js +2 -2
- package/dist/dependencies/commonjs/CommonJsExportRequireDependency.js +3 -3
- package/dist/dependencies/commonjs/CommonJsExportsDependency.js +2 -2
- package/dist/dependencies/commonjs/CommonJsExportsParserPlugin.js +1 -1
- package/dist/dependencies/commonjs/CommonJsFullRequireDependency.js +3 -3
- package/dist/dependencies/commonjs/CommonJsImportsParserPlugin.js +5 -5
- package/dist/dependencies/commonjs/CommonJsPlugin.js +7 -7
- package/dist/dependencies/commonjs/CommonJsRequireContextDependency.js +2 -2
- package/dist/dependencies/commonjs/CommonJsRequireDependency.js +2 -2
- package/dist/dependencies/commonjs/CommonJsSelfReferenceDependency.js +2 -2
- package/dist/dependencies/{local → commonjs}/LocalModuleDependency.js +2 -2
- package/dist/dependencies/{ModuleDecoratorDependency.js → commonjs/ModuleDecoratorDependency.js} +2 -2
- package/dist/dependencies/{RequireHeaderDependency.js → commonjs/RequireHeaderDependency.js} +2 -2
- package/dist/dependencies/{RequireResolveContextDependency.js → commonjs/RequireResolveContextDependency.js} +2 -2
- package/dist/dependencies/{RequireResolveDependency.js → commonjs/RequireResolveDependency.js} +3 -3
- package/dist/dependencies/{RequireResolveHeaderDependency.js → commonjs/RequireResolveHeaderDependency.js} +2 -2
- package/dist/dependencies/const/CachedConstDependency.js +3 -3
- package/dist/dependencies/const/ConstDependency.js +2 -2
- package/dist/dependencies/context/ContextDependency.d.ts +1 -1
- package/dist/dependencies/context/ContextDependency.js +3 -3
- package/dist/dependencies/context/ContextElementDependency.js +2 -2
- package/dist/dependencies/entry/EntryDependency.js +2 -2
- package/dist/dependencies/harmony/HarmonyAcceptDependency.js +3 -3
- package/dist/dependencies/harmony/HarmonyAcceptImportDependency.js +2 -2
- package/dist/dependencies/harmony/HarmonyCompatibilityDependency.js +2 -2
- package/dist/dependencies/harmony/HarmonyEvaluatedImportSpecifierDependency.js +2 -2
- package/dist/dependencies/harmony/HarmonyExportExpressionDependency.js +2 -2
- package/dist/dependencies/harmony/HarmonyExportHeaderDependency.js +2 -2
- package/dist/dependencies/harmony/HarmonyExportImportedSpecifierDependency.js +4 -4
- package/dist/dependencies/harmony/HarmonyExportSpecifierDependency.js +2 -2
- package/dist/dependencies/harmony/HarmonyImportDependency.js +1 -1
- package/dist/dependencies/harmony/HarmonyImportSideEffectDependency.js +2 -2
- package/dist/dependencies/harmony/HarmonyImportSpecifierDependency.js +2 -2
- package/dist/dependencies/import/ImportContextDependency.js +2 -2
- package/dist/dependencies/import/ImportDependency.js +2 -2
- package/dist/dependencies/import/ImportEagerDependency.js +2 -2
- package/dist/dependencies/import/ImportMetaContextDependency.js +2 -2
- package/dist/dependencies/import/ImportMetaHotAcceptDependency.js +2 -2
- package/dist/dependencies/import/ImportMetaHotDeclineDependency.js +2 -2
- package/dist/dependencies/import/ImportMetaPlugin.js +5 -5
- package/dist/dependencies/import/ImportWeakDependency.js +2 -2
- package/dist/dependencies/json/JsonExportsDependency.js +2 -2
- package/dist/dependencies/url/URLDependency.js +2 -2
- package/dist/index.d.ts +11 -1
- package/dist/index.js +21 -1
- package/dist/module/ExportsInfo.js +2 -2
- package/dist/module/Generator.d.ts +2 -2
- package/dist/module/Module.d.ts +3 -3
- package/dist/module/Module.js +2 -2
- package/dist/module/asset/RawDataUrlModule.js +2 -2
- package/dist/module/async-modules/AwaitDependenciesInitFragment.js +1 -1
- package/dist/module/context/ContextModule.js +3 -3
- package/dist/module/external/ExternalModule.js +4 -4
- package/dist/module/javascript/JavascriptModulesPlugin.js +1 -1
- package/dist/module/json/JsonData.js +1 -1
- package/dist/module/lazy/lazyModuleFactoryPlugin.js +2 -2
- package/dist/module/local/LocalModule.js +2 -2
- package/dist/module/normal/NormalModule.d.ts +2 -2
- package/dist/module/normal/NormalModule.js +30 -3
- package/dist/module/raw/RawModule.js +2 -2
- package/dist/module/runtime/AsyncModuleRuntimeModule.js +1 -1
- package/dist/module/runtime/AutoPublicPathRuntimeModule.d.ts +1 -1
- package/dist/module/runtime/AutoPublicPathRuntimeModule.js +2 -2
- package/dist/module/runtime/BaseUriRuntimeModule.d.ts +1 -1
- package/dist/module/runtime/BaseUriRuntimeModule.js +1 -1
- package/dist/module/runtime/ChunkNameRuntimeModule.d.ts +1 -1
- package/dist/module/runtime/ChunkNameRuntimeModule.js +1 -1
- package/dist/module/runtime/CompatGetDefaultExportRuntimeModule.js +1 -1
- package/dist/module/runtime/CompatRuntimeModule.d.ts +1 -1
- package/dist/module/runtime/CompatRuntimeModule.js +1 -1
- package/dist/module/runtime/CreateFakeNamespaceObjectRuntimeModule.js +1 -1
- package/dist/module/runtime/CreateScriptRuntimeModule.js +1 -1
- package/dist/module/runtime/CreateScriptUrlRuntimeModule.js +1 -1
- package/dist/module/runtime/DefinePropertyGettersRuntimeModule.js +1 -1
- package/dist/module/runtime/EnsureChunkRuntimeModule.d.ts +1 -1
- package/dist/module/runtime/EnsureChunkRuntimeModule.js +2 -2
- package/dist/module/runtime/GetChunkFilenameRuntimeModule.d.ts +1 -1
- package/dist/module/runtime/GetChunkFilenameRuntimeModule.js +2 -2
- package/dist/module/runtime/GetFullHashRuntimeModule.d.ts +1 -1
- package/dist/module/runtime/GetFullHashRuntimeModule.js +1 -1
- package/dist/module/runtime/GetMainFilenameRuntimeModule.d.ts +1 -1
- package/dist/module/runtime/GetMainFilenameRuntimeModule.js +2 -2
- package/dist/module/runtime/GetTrustedTypesPolicyRuntimeModule.js +1 -1
- package/dist/module/runtime/GlobalRuntimeModule.d.ts +1 -1
- package/dist/module/runtime/GlobalRuntimeModule.js +2 -2
- package/dist/module/runtime/HasOwnPropertyRuntimeModule.d.ts +1 -1
- package/dist/module/runtime/HasOwnPropertyRuntimeModule.js +2 -2
- package/dist/module/runtime/HelperRuntimeModule.d.ts +1 -1
- package/dist/module/runtime/HelperRuntimeModule.js +1 -1
- package/dist/module/runtime/JsonpChunkLoadingRuntimeModule.d.ts +1 -1
- package/dist/module/runtime/JsonpChunkLoadingRuntimeModule.js +2 -2
- package/dist/module/runtime/LoadScriptRuntimeModule.js +1 -1
- package/dist/module/runtime/MakeNamespaceObjectRuntimeModule.js +1 -1
- package/dist/module/runtime/NonceRuntimeModule.d.ts +1 -1
- package/dist/module/runtime/NonceRuntimeModule.js +1 -1
- package/dist/module/runtime/OnChunksLoadedRuntimeModule.d.ts +1 -1
- package/dist/module/runtime/OnChunksLoadedRuntimeModule.js +2 -2
- package/dist/module/runtime/PublicPathRuntimeModule.d.ts +1 -1
- package/dist/module/runtime/PublicPathRuntimeModule.js +1 -1
- package/dist/module/runtime/RelativeUrlRuntimeModule.js +1 -1
- package/dist/module/runtime/RuntimeIdRuntimeModule.d.ts +1 -1
- package/dist/module/runtime/RuntimeIdRuntimeModule.js +1 -1
- package/dist/module/{RuntimeModule.d.ts → runtime/RuntimeModule.d.ts} +3 -3
- package/dist/module/{RuntimeModule.js → runtime/RuntimeModule.js} +2 -2
- package/dist/module/{RuntimePlugin.js → runtime/RuntimePlugin.js} +25 -25
- package/dist/module/runtime/StartupChunkDependenciesRuntimeModule.d.ts +1 -1
- package/dist/module/runtime/StartupChunkDependenciesRuntimeModule.js +2 -2
- package/dist/module/runtime/StartupEntrypointRuntimeModule.d.ts +1 -1
- package/dist/module/runtime/StartupEntrypointRuntimeModule.js +1 -1
- package/dist/output/chunkFormat/ArrayPushCallbackChunkFormatPlugin.js +1 -1
- package/dist/output/library/AssignLibraryPlugin.js +1 -1
- package/dist/output/library/ModuleLibraryPlugin.js +1 -1
- package/dist/output/library/UmdLibraryPlugin.js +1 -1
- package/dist/plugins/BuildInfoPlugin.d.ts +6 -0
- package/dist/plugins/BuildInfoPlugin.js +21 -0
- package/dist/plugins/CompatibilityPlugin.js +5 -5
- package/dist/plugins/DefaultStatsPrinterPlugin.js +2 -2
- package/dist/plugins/miniCssExtractPlugin/MiniCssExtractPlugin.js +2 -2
- package/dist/plugins/optimize/ConcatenatedModule.js +3 -3
- package/dist/plugins/optimize/MangleExportsPlugin.js +1 -1
- package/dist/plugins/optimize/ModuleInfoHeaderPlugin.js +1 -1
- package/dist/{ResolverFactory.d.ts → resolver/ResolverFactory.d.ts} +1 -1
- package/dist/serialization/Serialization.d.ts +0 -1
- package/dist/serialization/Serialization.js +27 -28
- package/dist/serialization/internalSerializables.d.ts +63 -65
- package/dist/serialization/internalSerializables.js +64 -68
- package/dist/serialization/middlewares/BinaryMiddleware.d.ts +1 -1
- package/dist/serialization/middlewares/BinaryMiddleware.js +1 -1
- package/dist/serialization/middlewares/FileMiddleware.d.ts +1 -1
- package/dist/serialization/middlewares/FileMiddleware.js +1 -1
- package/dist/serialization/middlewares/ObjectMiddleware.d.ts +1 -1
- package/dist/serialization/middlewares/ObjectMiddleware.js +9 -9
- package/dist/serialization/middlewares/SingleItemMiddleware.d.ts +1 -1
- package/dist/serialization/middlewares/SingleItemMiddleware.js +1 -1
- package/dist/serialization/registerExternalSerializer.js +1 -1
- package/dist/setupWriteToDisk.d.ts +3 -0
- package/dist/setupWriteToDisk.js +38 -0
- package/dist/{chunk → templates}/ChunkTemplate.js +1 -6
- package/dist/{MainTemplate.js → templates/MainTemplate.js} +3 -3
- package/dist/{module → templates}/ModuleTemplate.js +1 -1
- package/dist/{module → templates}/RuntimeTemplate.d.ts +1 -1
- package/dist/{module → templates}/RuntimeTemplate.js +1 -1
- package/dist/templates/Template.d.ts +25 -0
- package/dist/templates/Template.js +269 -0
- package/dist/types/index.d.ts +39 -7
- package/package.json +9 -8
- package/dist/base/defaults.d.ts +0 -3
- package/dist/dependencies/css/CssExportDependency.d.ts +0 -17
- package/dist/dependencies/css/CssExportDependency.js +0 -49
- package/dist/dependencies/css/CssImportDependency.d.ts +0 -14
- package/dist/dependencies/css/CssImportDependency.js +0 -60
- package/dist/dependencies/css/CssLocalIdentifierDependency.d.ts +0 -12
- package/dist/dependencies/css/CssLocalIdentifierDependency.js +0 -69
- package/dist/dependencies/css/CssSelfLocalIdentifierDependency.d.ts +0 -13
- package/dist/dependencies/css/CssSelfLocalIdentifierDependency.js +0 -53
- package/dist/dependencies/css/CssUrlDependency.d.ts +0 -12
- package/dist/dependencies/css/CssUrlDependency.js +0 -89
- package/dist/module/css/CssModule.d.ts +0 -20
- package/dist/module/css/CssModule.js +0 -105
- /package/dist/dependencies/{local → commonjs}/LocalModuleDependency.d.ts +0 -0
- /package/dist/dependencies/{ModuleDecoratorDependency.d.ts → commonjs/ModuleDecoratorDependency.d.ts} +0 -0
- /package/dist/dependencies/{RequireHeaderDependency.d.ts → commonjs/RequireHeaderDependency.d.ts} +0 -0
- /package/dist/dependencies/{RequireResolveContextDependency.d.ts → commonjs/RequireResolveContextDependency.d.ts} +0 -0
- /package/dist/dependencies/{RequireResolveDependency.d.ts → commonjs/RequireResolveDependency.d.ts} +0 -0
- /package/dist/dependencies/{RequireResolveHeaderDependency.d.ts → commonjs/RequireResolveHeaderDependency.d.ts} +0 -0
- /package/dist/module/{JavascriptMetaInfoPlugin.d.ts → javascript/JavascriptMetaInfoPlugin.d.ts} +0 -0
- /package/dist/module/{JavascriptMetaInfoPlugin.js → javascript/JavascriptMetaInfoPlugin.js} +0 -0
- /package/dist/module/{RuntimePlugin.d.ts → runtime/RuntimePlugin.d.ts} +0 -0
- /package/dist/{ResolverFactory.js → resolver/ResolverFactory.js} +0 -0
- /package/dist/serialization/{SerializerMiddleware.d.ts → middlewares/SerializerMiddleware.d.ts} +0 -0
- /package/dist/serialization/{SerializerMiddleware.js → middlewares/SerializerMiddleware.js} +0 -0
- /package/dist/serialization/{serializers → middlewares/objectSerializers}/ArraySerializer.d.ts +0 -0
- /package/dist/serialization/{serializers → middlewares/objectSerializers}/ArraySerializer.js +0 -0
- /package/dist/serialization/{serializers → middlewares/objectSerializers}/DateObjectSerializer.d.ts +0 -0
- /package/dist/serialization/{serializers → middlewares/objectSerializers}/DateObjectSerializer.js +0 -0
- /package/dist/serialization/{serializers → middlewares/objectSerializers}/ErrorObjectSerializer.d.ts +0 -0
- /package/dist/serialization/{serializers → middlewares/objectSerializers}/ErrorObjectSerializer.js +0 -0
- /package/dist/serialization/{serializers → middlewares/objectSerializers}/MapObjectSerializer.d.ts +0 -0
- /package/dist/serialization/{serializers → middlewares/objectSerializers}/MapObjectSerializer.js +0 -0
- /package/dist/serialization/{serializers → middlewares/objectSerializers}/NullPrototypeObjectSerializer.d.ts +0 -0
- /package/dist/serialization/{serializers → middlewares/objectSerializers}/NullPrototypeObjectSerializer.js +0 -0
- /package/dist/serialization/{serializers → middlewares/objectSerializers}/PlainObjectSerializer.d.ts +0 -0
- /package/dist/serialization/{serializers → middlewares/objectSerializers}/PlainObjectSerializer.js +0 -0
- /package/dist/serialization/{serializers → middlewares/objectSerializers}/RegExpObjectSerializer.d.ts +0 -0
- /package/dist/serialization/{serializers → middlewares/objectSerializers}/RegExpObjectSerializer.js +0 -0
- /package/dist/serialization/{serializers → middlewares/objectSerializers}/SetObjectSerializer.d.ts +0 -0
- /package/dist/serialization/{serializers → middlewares/objectSerializers}/SetObjectSerializer.js +0 -0
- /package/dist/serialization/{makeSerializable.d.ts → registerInternalSerializer.d.ts} +0 -0
- /package/dist/serialization/{makeSerializable.js → registerInternalSerializer.js} +0 -0
- /package/dist/{chunk → templates}/ChunkTemplate.d.ts +0 -0
- /package/dist/{dependencies → templates}/DependencyTemplate.d.ts +0 -0
- /package/dist/{dependencies → templates}/DependencyTemplate.js +0 -0
- /package/dist/{dependencies → templates}/DependencyTemplates.d.ts +0 -0
- /package/dist/{dependencies → templates}/DependencyTemplates.js +0 -0
- /package/dist/{MainTemplate.d.ts → templates/MainTemplate.d.ts} +0 -0
- /package/dist/{module → templates}/ModuleTemplate.d.ts +0 -0
package/dist/Compilation.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import ChunkTemplate from '@/chunk/ChunkTemplate';
|
|
2
1
|
import CodeGenerationResults from '@/chunk/CodeGenerationResults';
|
|
3
2
|
import Dependency from '@/dependencies/Dependency';
|
|
4
|
-
import DependencyTemplates from '@/
|
|
3
|
+
import DependencyTemplates from '@/templates/DependencyTemplates';
|
|
5
4
|
import Entrypoint from '@/chunk/Entrypoint';
|
|
6
|
-
import MainTemplate from '@/MainTemplate';
|
|
5
|
+
import MainTemplate from '@/templates/MainTemplate';
|
|
6
|
+
import ChunkTemplate from '@/templates/ChunkTemplate';
|
|
7
|
+
import ModuleTemplate from '@/templates/ModuleTemplate';
|
|
8
|
+
import RuntimeTemplate from '@/templates/RuntimeTemplate';
|
|
7
9
|
import ModuleGraph from '@/module/ModuleGraph';
|
|
8
|
-
import ModuleTemplate from '@/module/ModuleTemplate';
|
|
9
|
-
import RuntimeTemplate from '@/module/RuntimeTemplate';
|
|
10
10
|
import Stats from '@/base/stats/Stats';
|
|
11
11
|
import BaseError from '@/base/errors/BaseError';
|
|
12
12
|
import StatsFactory from '@/base/stats/StatsFactory';
|
package/dist/Compilation.js
CHANGED
|
@@ -46,16 +46,18 @@ const Chunk_1 = __importDefault(require("@/chunk/Chunk"));
|
|
|
46
46
|
const ChunkGraph_1 = __importDefault(require("@/chunk/ChunkGraph"));
|
|
47
47
|
const ChunkGroup_1 = __importDefault(require("@/chunk/ChunkGroup"));
|
|
48
48
|
const ChunkRenderError_1 = __importDefault(require("@/base/errors/ChunkRenderError"));
|
|
49
|
-
const ChunkTemplate_1 = __importDefault(require("@/chunk/ChunkTemplate"));
|
|
50
49
|
const CodeGenerationError_1 = __importDefault(require("@/base/errors/CodeGenerationError"));
|
|
51
50
|
const CodeGenerationResults_1 = __importDefault(require("@/chunk/CodeGenerationResults"));
|
|
52
51
|
const Dependency_1 = __importDefault(require("@/dependencies/Dependency"));
|
|
53
|
-
const DependencyTemplates_1 = __importDefault(require("@/
|
|
52
|
+
const DependencyTemplates_1 = __importDefault(require("@/templates/DependencyTemplates"));
|
|
54
53
|
const Entrypoint_1 = __importDefault(require("@/chunk/Entrypoint"));
|
|
55
54
|
const ErrorHelpers = __importStar(require("@/base/errors/ErrorHelpers"));
|
|
56
55
|
const GraphHelpers_1 = require("@/base/GraphHelpers");
|
|
57
56
|
const HookBaseError_1 = require("@/base/errors/HookBaseError");
|
|
58
|
-
const MainTemplate_1 = __importDefault(require("@/MainTemplate"));
|
|
57
|
+
const MainTemplate_1 = __importDefault(require("@/templates/MainTemplate"));
|
|
58
|
+
const ChunkTemplate_1 = __importDefault(require("@/templates/ChunkTemplate"));
|
|
59
|
+
const ModuleTemplate_1 = __importDefault(require("@/templates/ModuleTemplate"));
|
|
60
|
+
const RuntimeTemplate_1 = __importDefault(require("@/templates/RuntimeTemplate"));
|
|
59
61
|
const Module_1 = __importDefault(require("@/module/Module"));
|
|
60
62
|
const ModuleDependencyError_1 = __importDefault(require("@/base/errors/ModuleDependencyError"));
|
|
61
63
|
const ModuleDependencyWarning_1 = __importDefault(require("@/base/errors/ModuleDependencyWarning"));
|
|
@@ -65,10 +67,8 @@ const ModuleNotFoundError_1 = __importDefault(require("@/base/errors/ModuleNotFo
|
|
|
65
67
|
const ModuleProfile_1 = __importDefault(require("@/module/ModuleProfile"));
|
|
66
68
|
const ModuleRestoreError_1 = __importDefault(require("@/base/errors/ModuleRestoreError"));
|
|
67
69
|
const ModuleStoreError_1 = __importDefault(require("@/base/errors/ModuleStoreError"));
|
|
68
|
-
const ModuleTemplate_1 = __importDefault(require("@/module/ModuleTemplate"));
|
|
69
70
|
const ModuleTypeConstants_1 = require("@/module/ModuleTypeConstants");
|
|
70
71
|
const RuntimeGlobals = __importStar(require("@/module/RuntimeGlobals"));
|
|
71
|
-
const RuntimeTemplate_1 = __importDefault(require("@/module/RuntimeTemplate"));
|
|
72
72
|
const Stats_1 = __importDefault(require("@/base/stats/Stats"));
|
|
73
73
|
const BaseError_1 = __importDefault(require("@/base/errors/BaseError"));
|
|
74
74
|
const buildChunkGraph_1 = __importDefault(require("@/chunk/buildChunkGraph"));
|
package/dist/Compiler.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import ContextModuleFactory from '@/module/context/ContextModuleFactory';
|
|
|
4
4
|
import NormalModuleFactory from '@/module/normal/NormalModuleFactory';
|
|
5
5
|
import RequestShortener from '@/base/RequestShortener';
|
|
6
6
|
import { Logger } from './base/logging/Logger';
|
|
7
|
-
import ResolverFactory from './ResolverFactory';
|
|
7
|
+
import ResolverFactory from './resolver/ResolverFactory';
|
|
8
8
|
declare class Compiler {
|
|
9
9
|
MPPack: any;
|
|
10
10
|
project: any;
|
|
@@ -46,7 +46,7 @@ declare class Compiler {
|
|
|
46
46
|
_assetEmittingWrittenFiles: Map<any, any>;
|
|
47
47
|
_assetEmittingPreviousFiles: Set<any>;
|
|
48
48
|
constructor(project: any, packSetting: any, options?: any);
|
|
49
|
-
|
|
49
|
+
makeMPPackCompalibility(): void;
|
|
50
50
|
getCache(name: any): CacheFacade;
|
|
51
51
|
getInfrastructureLogger(name: any): Logger;
|
|
52
52
|
_cleanupLastCompilation(): void;
|
package/dist/Compiler.js
CHANGED
|
@@ -47,7 +47,7 @@ const ModuleFilenameHelpers = __importStar(require("@/base/ModuleFilenameHelpers
|
|
|
47
47
|
const JavascriptModulesPlugin_1 = require("./module/javascript/JavascriptModulesPlugin");
|
|
48
48
|
const Logger_1 = require("./base/logging/Logger");
|
|
49
49
|
const Watching_1 = __importDefault(require("./Watching"));
|
|
50
|
-
const ResolverFactory_1 = __importDefault(require("./ResolverFactory"));
|
|
50
|
+
const ResolverFactory_1 = __importDefault(require("./resolver/ResolverFactory"));
|
|
51
51
|
const Compilation_1 = __importDefault(require("./Compilation"));
|
|
52
52
|
const MPPack_1 = require("./MPPack");
|
|
53
53
|
const isSorted = (array) => {
|
|
@@ -139,10 +139,10 @@ class Compiler {
|
|
|
139
139
|
this.running = false;
|
|
140
140
|
this.idle = false;
|
|
141
141
|
this.watchMode = false;
|
|
142
|
-
this.
|
|
142
|
+
this.makeMPPackCompalibility();
|
|
143
143
|
}
|
|
144
144
|
// 注册webpack对象,兼容webpack插件
|
|
145
|
-
|
|
145
|
+
makeMPPackCompalibility() {
|
|
146
146
|
this.MPPack = MPPack_1.MPPack;
|
|
147
147
|
// @ts-ignore
|
|
148
148
|
this.webpack = {
|
package/dist/FileSystemInfo.js
CHANGED
|
@@ -12,7 +12,7 @@ const AsyncQueue_1 = __importDefault(require("@/base/AsyncQueue"));
|
|
|
12
12
|
const StackedCacheMap_1 = __importDefault(require("@/base/StackedCacheMap"));
|
|
13
13
|
const createHash_1 = __importDefault(require("@/base/createHash"));
|
|
14
14
|
const fs_1 = require("@/base/fs");
|
|
15
|
-
const
|
|
15
|
+
const registerInternalSerializer_1 = __importDefault(require("@/serialization/registerInternalSerializer"));
|
|
16
16
|
const processAsyncTree_1 = __importDefault(require("@/base/processAsyncTree"));
|
|
17
17
|
const es_module_lexer_1 = __importDefault(require("es-module-lexer"));
|
|
18
18
|
const supportsEsm = +process.versions.modules >= 83;
|
|
@@ -323,7 +323,7 @@ class Snapshot {
|
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
325
|
exports.Snapshot = Snapshot;
|
|
326
|
-
(0,
|
|
326
|
+
(0, registerInternalSerializer_1.default)(Snapshot, 'mp-pack/FileSystemInfo', 'Snapshot');
|
|
327
327
|
const MIN_COMMON_SNAPSHOT_SIZE = 3;
|
|
328
328
|
class SnapshotOptimization {
|
|
329
329
|
constructor(has, get, set, useStartTime = true, isSet = false) {
|
package/dist/MPPack.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
import 'module-alias';
|
|
2
3
|
import { Project } from 'xhs-mp-project';
|
|
3
4
|
import MPPackSetting from '@/MPPackSetting';
|
|
4
5
|
import { EventEmitter } from 'events';
|
|
@@ -22,7 +23,8 @@ export declare class MPPack extends AbstractMPPack {
|
|
|
22
23
|
constructor(options: ICompileOptions);
|
|
23
24
|
createCompiler(compilerConfigs: any): void;
|
|
24
25
|
private doCreateCompiler;
|
|
25
|
-
handleProgress: (
|
|
26
|
+
handleProgress: (percentage: any, status: any, ...info: any[]) => void;
|
|
27
|
+
handleBuildInfo: (info: any) => void;
|
|
26
28
|
get hooks(): any;
|
|
27
29
|
watch(config: any, callback?: any): Promise<unknown>;
|
|
28
30
|
changeCompileOptions(config: any): void;
|
package/dist/MPPack.js
CHANGED
|
@@ -4,25 +4,29 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.MPPack = exports.AbstractMPPack = void 0;
|
|
7
|
+
require("module-alias");
|
|
7
8
|
const xhs_mp_project_1 = require("xhs-mp-project");
|
|
8
9
|
const ProgressPlugin_1 = __importDefault(require("@/plugins/ProgressPlugin"));
|
|
10
|
+
const BuildInfoPlugin_1 = __importDefault(require("@/plugins/BuildInfoPlugin"));
|
|
9
11
|
const MPPackSetting_1 = __importDefault(require("@/MPPackSetting"));
|
|
10
12
|
const events_1 = require("events");
|
|
11
13
|
const Compiler_1 = __importDefault(require("@/Compiler"));
|
|
12
14
|
const MultiCompiler_1 = __importDefault(require("@/MultiCompiler"));
|
|
13
15
|
const PluginManager_1 = __importDefault(require("@/PluginManager"));
|
|
14
|
-
const
|
|
16
|
+
const applyDefaults_1 = require("@/applyDefaults");
|
|
15
17
|
const const_1 = __importDefault(require("@/base/const"));
|
|
16
18
|
const CachedInputFileSystem_1 = __importDefault(require("enhanced-resolve/lib/CachedInputFileSystem"));
|
|
17
19
|
const graceful_fs_1 = __importDefault(require("graceful-fs"));
|
|
18
20
|
const createConsoleLogger_1 = __importDefault(require("@/base/logging/createConsoleLogger"));
|
|
19
21
|
const nodeConsole_1 = __importDefault(require("@/base/logging/nodeConsole"));
|
|
20
22
|
const NodeWatchFileSystem_1 = __importDefault(require("@/base/NodeWatchFileSystem"));
|
|
23
|
+
const types_1 = require("./types");
|
|
21
24
|
const normalization_1 = require("./base/normalization");
|
|
25
|
+
const setupWriteToDisk_1 = __importDefault(require("./setupWriteToDisk"));
|
|
22
26
|
const watchOptions = {
|
|
23
27
|
aggregateTimeout: 300,
|
|
24
28
|
poll: false,
|
|
25
|
-
ignored: ['**/node_modules', 'project.config.json', 'project.private.config.json']
|
|
29
|
+
ignored: ['**/node_modules', 'project.config.json', 'project.private.config.json']
|
|
26
30
|
};
|
|
27
31
|
const { BUILD_REASON } = const_1.default;
|
|
28
32
|
class AbstractMPPack extends events_1.EventEmitter {
|
|
@@ -44,12 +48,22 @@ class MPPack extends AbstractMPPack {
|
|
|
44
48
|
(0, nodeConsole_1.default)({
|
|
45
49
|
colors: infrastructureLogging.colors,
|
|
46
50
|
appendOnly: infrastructureLogging.appendOnly,
|
|
47
|
-
stream: infrastructureLogging.stream
|
|
48
|
-
})
|
|
51
|
+
stream: infrastructureLogging.stream
|
|
52
|
+
})
|
|
49
53
|
});
|
|
50
54
|
compiler.inputFileSystem = new CachedInputFileSystem_1.default(graceful_fs_1.default, 60000);
|
|
51
55
|
const inputFileSystem = compiler.inputFileSystem;
|
|
52
|
-
|
|
56
|
+
if (this.packSetting.env === types_1.ENV.development) {
|
|
57
|
+
const SharedFs = require('xhs-mp-shared-fs');
|
|
58
|
+
const sharedFs = new SharedFs();
|
|
59
|
+
compiler.outputFileSystem = sharedFs;
|
|
60
|
+
if (this.packSetting.devWriteToDisk) {
|
|
61
|
+
(0, setupWriteToDisk_1.default)(compiler, this.packSetting);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
compiler.outputFileSystem = graceful_fs_1.default;
|
|
66
|
+
}
|
|
53
67
|
compiler.intermediateFileSystem = graceful_fs_1.default;
|
|
54
68
|
compiler.watchFileSystem = new NodeWatchFileSystem_1.default(compiler.inputFileSystem);
|
|
55
69
|
compiler.hooks.beforeRun.tap('NodeEnvironmentPlugin', compiler => {
|
|
@@ -68,26 +82,35 @@ class MPPack extends AbstractMPPack {
|
|
|
68
82
|
}
|
|
69
83
|
}
|
|
70
84
|
}
|
|
71
|
-
(0,
|
|
85
|
+
(0, applyDefaults_1.applyMPPackOptionsDefaults)(options);
|
|
72
86
|
compiler.hooks.environment.call();
|
|
73
87
|
compiler.hooks.afterEnvironment.call();
|
|
74
88
|
new PluginManager_1.default().setup(options, compiler);
|
|
75
89
|
return compiler;
|
|
76
90
|
};
|
|
77
|
-
this.handleProgress =
|
|
78
|
-
this.emit('progress',
|
|
91
|
+
this.handleProgress = (percentage, status, ...info) => {
|
|
92
|
+
this.emit('progress', {
|
|
93
|
+
percentage,
|
|
94
|
+
status,
|
|
95
|
+
info
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
this.handleBuildInfo = (info) => {
|
|
99
|
+
this.emit('buildInfo', info);
|
|
79
100
|
};
|
|
80
101
|
const { projectPath, project, platform } = options;
|
|
81
102
|
process.env.__platform = platform;
|
|
82
|
-
this.project =
|
|
83
|
-
|
|
84
|
-
|
|
103
|
+
this.project =
|
|
104
|
+
project ||
|
|
105
|
+
new xhs_mp_project_1.Project({
|
|
106
|
+
projectPath: projectPath
|
|
107
|
+
});
|
|
85
108
|
this.packSetting = new MPPackSetting_1.default(this.project, options);
|
|
86
109
|
}
|
|
87
110
|
createCompiler(compilerConfigs) {
|
|
88
111
|
compilerConfigs = compilerConfigs.map(rawOption => {
|
|
89
|
-
const options = (0, normalization_1.
|
|
90
|
-
(0,
|
|
112
|
+
const options = (0, normalization_1.getNormalizedMPPackOptions)(rawOption);
|
|
113
|
+
(0, applyDefaults_1.applyMPPackOptionsBaseDefaults)(options);
|
|
91
114
|
return options;
|
|
92
115
|
});
|
|
93
116
|
const compilers = compilerConfigs.map(options => this.doCreateCompiler(options));
|
|
@@ -98,7 +121,14 @@ class MPPack extends AbstractMPPack {
|
|
|
98
121
|
}
|
|
99
122
|
}
|
|
100
123
|
this.compiler = compiler;
|
|
101
|
-
|
|
124
|
+
// setupHooks(this);
|
|
125
|
+
new ProgressPlugin_1.default({
|
|
126
|
+
activeModules: true,
|
|
127
|
+
handler: this.handleProgress
|
|
128
|
+
}).apply(this.compiler);
|
|
129
|
+
new BuildInfoPlugin_1.default({
|
|
130
|
+
handler: this.handleBuildInfo
|
|
131
|
+
}).apply(this.compiler);
|
|
102
132
|
}
|
|
103
133
|
get hooks() {
|
|
104
134
|
return this.compiler.hooks;
|
|
@@ -112,7 +142,7 @@ class MPPack extends AbstractMPPack {
|
|
|
112
142
|
this.watcher = this.compiler.watch(Object.assign(Object.assign({}, watchOptions), config), (err, stats) => {
|
|
113
143
|
var _a, _b;
|
|
114
144
|
const buildReason = (_b = (_a = stats === null || stats === void 0 ? void 0 : stats.stats) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.buildReason;
|
|
115
|
-
console.log('buildReason', buildReason);
|
|
145
|
+
console.log('[compiler]buildReason', buildReason);
|
|
116
146
|
if (this.callbacks.length) {
|
|
117
147
|
this.callbacks.forEach(callback => callback({ err, stats }));
|
|
118
148
|
this.callbacks = [];
|
package/dist/MPPackSetting.d.ts
CHANGED
|
@@ -6,17 +6,32 @@ declare class MPPackSetting {
|
|
|
6
6
|
distDir: string;
|
|
7
7
|
env: ENV;
|
|
8
8
|
tsConfigPath?: string;
|
|
9
|
+
enablePersistCache?: boolean;
|
|
9
10
|
cacheDirectory?: string;
|
|
10
11
|
action: string;
|
|
11
|
-
|
|
12
|
+
compressCss: boolean;
|
|
12
13
|
compressJs: boolean;
|
|
13
14
|
enableVDom: boolean;
|
|
14
15
|
enableV2: boolean;
|
|
15
16
|
enableV1: boolean;
|
|
16
17
|
compilePkgs: string[];
|
|
17
|
-
|
|
18
|
+
/**
|
|
19
|
+
* 是否开启 sourcemap
|
|
20
|
+
* 默认开启true
|
|
21
|
+
*/
|
|
22
|
+
enableSourcemap?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* 是否在js尾部添加sourcemap注释
|
|
25
|
+
* 默认是会的,上传时不应该添加
|
|
26
|
+
*/
|
|
27
|
+
appendSourcemapComment?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* 是否自适应逻辑层环境,即是否采用(function(window,...){用户代码})(undefined,...)包裹
|
|
30
|
+
* 默认是false
|
|
31
|
+
*/
|
|
32
|
+
runInServiceSandbox?: boolean;
|
|
18
33
|
compileType: string;
|
|
19
|
-
|
|
34
|
+
devWriteToDisk: boolean;
|
|
20
35
|
constructor(project: Project, options: ICompileOptions);
|
|
21
36
|
get usingPackageType(): "v2" | "v1";
|
|
22
37
|
serialize(): {
|
|
@@ -27,17 +42,20 @@ declare class MPPackSetting {
|
|
|
27
42
|
project?: Project | undefined;
|
|
28
43
|
projectPath?: string | undefined;
|
|
29
44
|
platform?: "wx" | "xhs" | undefined;
|
|
45
|
+
enablePersistCache?: boolean | undefined;
|
|
30
46
|
clearDistDir?: boolean | undefined;
|
|
47
|
+
action: "build" | "dev";
|
|
48
|
+
compressCss?: boolean | undefined;
|
|
31
49
|
compressJs?: boolean | undefined;
|
|
50
|
+
enableSourcemap?: boolean | undefined;
|
|
51
|
+
appendSourcemapComment?: boolean | undefined;
|
|
52
|
+
runInServiceSandbox?: boolean | undefined;
|
|
32
53
|
enableVDom?: boolean | undefined;
|
|
33
54
|
enableV2?: boolean | undefined;
|
|
34
55
|
enableV1?: boolean | undefined;
|
|
35
|
-
action: "build" | "dev";
|
|
36
|
-
watch?: boolean | undefined;
|
|
37
|
-
enableSourcemap?: boolean | undefined;
|
|
38
56
|
compilePkgs?: string[] | undefined;
|
|
39
57
|
compileType?: string | undefined;
|
|
40
|
-
|
|
58
|
+
devWriteToDisk?: boolean | undefined;
|
|
41
59
|
callback?: (() => void) | undefined;
|
|
42
60
|
};
|
|
43
61
|
static deSerialize(project: any, options: any): MPPackSetting;
|
package/dist/MPPackSetting.js
CHANGED
|
@@ -11,15 +11,15 @@ const types_1 = require("./types");
|
|
|
11
11
|
class MPPackSetting {
|
|
12
12
|
constructor(project, options) {
|
|
13
13
|
this.compilePkgs = [];
|
|
14
|
-
const { action,
|
|
14
|
+
const { action, tsConfigPath, compressCss = true, compressJs = true, enableSourcemap = true, appendSourcemapComment = true, runInServiceSandbox = false, enableVDom = false, enableV2 = false, enableV1 = true, compilePkgs = [], compileType = '', clearDistDir = true, devWriteToDisk = false, enablePersistCache, cacheDirectory = '' } = options;
|
|
15
15
|
this.project = project;
|
|
16
16
|
this.options = options;
|
|
17
17
|
this.distDir = (0, utils_1.formatPath)(options.distDir || path_1.default.join(process.cwd(), 'dist'));
|
|
18
18
|
this.env = action === 'dev' ? types_1.ENV.development : types_1.ENV.production;
|
|
19
19
|
this.action = action;
|
|
20
|
-
this.watch = watch;
|
|
21
20
|
this.tsConfigPath = (0, utils_1.formatPath)(tsConfigPath || (0, common_1.getTsConfigPath)(project.projectPath));
|
|
22
|
-
this.
|
|
21
|
+
this.enablePersistCache = enablePersistCache;
|
|
22
|
+
this.cacheDirectory = (0, utils_1.formatPath)(cacheDirectory);
|
|
23
23
|
this.enableVDom = enableVDom;
|
|
24
24
|
this.enableV2 = enableV2;
|
|
25
25
|
this.enableV1 = enableV1;
|
|
@@ -30,11 +30,14 @@ class MPPackSetting {
|
|
|
30
30
|
this.enableV1 = true;
|
|
31
31
|
this.enableV2 = false;
|
|
32
32
|
}
|
|
33
|
+
this.compressCss = compressCss;
|
|
33
34
|
this.compressJs = compressJs;
|
|
34
35
|
this.enableSourcemap = enableSourcemap;
|
|
36
|
+
this.appendSourcemapComment = appendSourcemapComment;
|
|
37
|
+
this.runInServiceSandbox = runInServiceSandbox;
|
|
35
38
|
this.compilePkgs = compilePkgs;
|
|
36
39
|
this.compileType = compileType;
|
|
37
|
-
this.
|
|
40
|
+
this.devWriteToDisk = devWriteToDisk;
|
|
38
41
|
if (clearDistDir) {
|
|
39
42
|
try {
|
|
40
43
|
if (fs_extra_1.default.existsSync(this.distDir)) {
|
package/dist/PluginManager.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ declare class PluginManager {
|
|
|
2
2
|
setup(options: any, compiler: any): any;
|
|
3
3
|
setupIdPlugins(compiler: any, options: any): void;
|
|
4
4
|
setupCachePlugins(compiler: any, options: any): void;
|
|
5
|
+
setupResolver(compiler: any, options: any): void;
|
|
5
6
|
setupSourceMapPlugins(compiler: any, options: any): void;
|
|
6
7
|
setupEntryPlugins(compiler: any, options: any): void;
|
|
7
8
|
setupOptimizePlugins(compiler: any, options: any): void;
|
package/dist/PluginManager.js
CHANGED
|
@@ -9,8 +9,8 @@ const JavascriptModulesPlugin_1 = require("@/module/javascript/JavascriptModules
|
|
|
9
9
|
const JsonModulesPlugin_1 = __importDefault(require("@/module/json/JsonModulesPlugin"));
|
|
10
10
|
const ExternalsPlugin_1 = __importDefault(require("@/module/external/ExternalsPlugin"));
|
|
11
11
|
const InferAsyncModulesPlugin_1 = __importDefault(require("@/module/async-modules/InferAsyncModulesPlugin"));
|
|
12
|
-
const JavascriptMetaInfoPlugin_1 = __importDefault(require("@/module/JavascriptMetaInfoPlugin"));
|
|
13
|
-
const RuntimePlugin_1 = __importDefault(require("@/module/RuntimePlugin"));
|
|
12
|
+
const JavascriptMetaInfoPlugin_1 = __importDefault(require("@/module/javascript/JavascriptMetaInfoPlugin"));
|
|
13
|
+
const RuntimePlugin_1 = __importDefault(require("@/module/runtime/RuntimePlugin"));
|
|
14
14
|
const RecordIdsPlugin_1 = __importDefault(require("@/plugins/RecordIdsPlugin"));
|
|
15
15
|
const CompatibilityPlugin_1 = __importDefault(require("@/plugins/CompatibilityPlugin"));
|
|
16
16
|
const ConstPlugin_1 = __importDefault(require("@/plugins/ConstPlugin"));
|
|
@@ -20,13 +20,6 @@ const WarnCaseSensitiveModulesPlugin_1 = __importDefault(require("@/plugins/Warn
|
|
|
20
20
|
const TemplatedPathPlugin_1 = __importDefault(require("@/plugins/TemplatedPathPlugin"));
|
|
21
21
|
const DataUriPlugin_1 = __importDefault(require("@/module/uri/DataUriPlugin"));
|
|
22
22
|
const FileUriPlugin_1 = __importDefault(require("@/module/uri/FileUriPlugin"));
|
|
23
|
-
const CommonJsPlugin_1 = __importDefault(require("@/dependencies/commonjs/CommonJsPlugin"));
|
|
24
|
-
const HarmonyModulesPlugin_1 = __importDefault(require("@/dependencies/harmony/HarmonyModulesPlugin"));
|
|
25
|
-
const ImportMetaContextPlugin_1 = __importDefault(require("@/dependencies/import/ImportMetaContextPlugin"));
|
|
26
|
-
const ImportMetaPlugin_1 = __importDefault(require("@/dependencies/import/ImportMetaPlugin"));
|
|
27
|
-
const ImportPlugin_1 = __importDefault(require("@/dependencies/import/ImportPlugin"));
|
|
28
|
-
const LoaderPlugin_1 = __importDefault(require("@/dependencies/loader/LoaderPlugin"));
|
|
29
|
-
const URLPlugin_1 = __importDefault(require("@/dependencies/url/URLPlugin"));
|
|
30
23
|
const ArrayPushCallbackChunkFormatPlugin_1 = __importDefault(require("@/output/chunkFormat/ArrayPushCallbackChunkFormatPlugin"));
|
|
31
24
|
const JsonpChunkLoadingPlugin_1 = __importDefault(require("@/output/chunkLoading/JsonpChunkLoadingPlugin"));
|
|
32
25
|
const EvalSourceMapDevToolPlugin_1 = __importDefault(require("@/sourcemap/EvalSourceMapDevToolPlugin"));
|
|
@@ -39,8 +32,17 @@ const cleverMerge_1 = require("@/base/cleverMerge");
|
|
|
39
32
|
const lazyModuleFactoryPlugin_1 = __importDefault(require("./module/lazy/lazyModuleFactoryPlugin"));
|
|
40
33
|
// runtime
|
|
41
34
|
const APIPlugin_1 = __importDefault(require("./plugins/APIPlugin"));
|
|
35
|
+
// import MPPackIsIncludedPlugin from './MPPackIsIncludedPlugin'
|
|
36
|
+
// uri
|
|
42
37
|
// dependencies
|
|
43
38
|
const DynamicEntryPlugin_1 = __importDefault(require("./dependencies/entry/DynamicEntryPlugin"));
|
|
39
|
+
const CommonJsPlugin_1 = __importDefault(require("@/dependencies/commonjs/CommonJsPlugin"));
|
|
40
|
+
const HarmonyModulesPlugin_1 = __importDefault(require("@/dependencies/harmony/HarmonyModulesPlugin"));
|
|
41
|
+
const ImportMetaContextPlugin_1 = __importDefault(require("@/dependencies/import/ImportMetaContextPlugin"));
|
|
42
|
+
const ImportMetaPlugin_1 = __importDefault(require("@/dependencies/import/ImportMetaPlugin"));
|
|
43
|
+
const ImportPlugin_1 = __importDefault(require("@/dependencies/import/ImportPlugin"));
|
|
44
|
+
const LoaderPlugin_1 = __importDefault(require("@/dependencies/loader/LoaderPlugin"));
|
|
45
|
+
const URLPlugin_1 = __importDefault(require("@/dependencies/url/URLPlugin"));
|
|
44
46
|
// output library
|
|
45
47
|
const EnableLibraryPlugin_1 = __importDefault(require("./output/library/EnableLibraryPlugin"));
|
|
46
48
|
// output chunkFormat
|
|
@@ -72,11 +74,7 @@ const RealContentHashPlugin_1 = __importDefault(require("./plugins/optimize/Real
|
|
|
72
74
|
const NoEmitOnErrorsPlugin_1 = __importDefault(require("./plugins/optimize/NoEmitOnErrorsPlugin"));
|
|
73
75
|
// cache
|
|
74
76
|
const AddManagedPathsPlugin_1 = __importDefault(require("./cache/AddManagedPathsPlugin"));
|
|
75
|
-
const MemoryWithGcCachePlugin_1 = __importDefault(require("./cache/MemoryWithGcCachePlugin"));
|
|
76
|
-
const MemoryCachePlugin_1 = __importDefault(require("./cache/MemoryCachePlugin"));
|
|
77
77
|
const AddBuildDependenciesPlugin_1 = __importDefault(require("./cache/AddBuildDependenciesPlugin"));
|
|
78
|
-
// import IdleFileCachePlugin from './cache/IdleFileCachePlugin'
|
|
79
|
-
// import PackFileCacheStrategy from './cache/PackFileCacheStrategy'
|
|
80
78
|
const NodeStuffPlugin_1 = __importDefault(require("./plugins/NodeStuffPlugin"));
|
|
81
79
|
// stat
|
|
82
80
|
class PluginManager {
|
|
@@ -87,6 +85,7 @@ class PluginManager {
|
|
|
87
85
|
compiler.name = options.name;
|
|
88
86
|
// module
|
|
89
87
|
new JavascriptModulesPlugin_1.JavascriptModulesPlugin().apply(compiler);
|
|
88
|
+
new JavascriptMetaInfoPlugin_1.default().apply(compiler);
|
|
90
89
|
new JsonModulesPlugin_1.default().apply(compiler);
|
|
91
90
|
new AssetModulesPlugin_1.default().apply(compiler);
|
|
92
91
|
if (options.externals) {
|
|
@@ -95,6 +94,11 @@ class PluginManager {
|
|
|
95
94
|
if (options.mode !== 'production') {
|
|
96
95
|
new lazyModuleFactoryPlugin_1.default({}).apply(compiler);
|
|
97
96
|
}
|
|
97
|
+
new RuntimePlugin_1.default().apply(compiler);
|
|
98
|
+
new InferAsyncModulesPlugin_1.default().apply(compiler);
|
|
99
|
+
new DataUriPlugin_1.default().apply(compiler);
|
|
100
|
+
new FileUriPlugin_1.default().apply(compiler);
|
|
101
|
+
new ExportsInfoApiPlugin_1.default().apply(compiler);
|
|
98
102
|
// 输出的chunkFormat
|
|
99
103
|
new ArrayPushCallbackChunkFormatPlugin_1.default().apply(compiler);
|
|
100
104
|
// chunkLoading
|
|
@@ -110,39 +114,34 @@ class PluginManager {
|
|
|
110
114
|
if (options.output.pathinfo) {
|
|
111
115
|
new ModuleInfoHeaderPlugin_1.default(options.output.pathinfo !== true).apply(compiler);
|
|
112
116
|
}
|
|
113
|
-
|
|
114
|
-
new InferAsyncModulesPlugin_1.default().apply(compiler);
|
|
115
|
-
new DataUriPlugin_1.default().apply(compiler);
|
|
116
|
-
new FileUriPlugin_1.default().apply(compiler);
|
|
117
|
-
new CompatibilityPlugin_1.default().apply(compiler);
|
|
117
|
+
// denpendencies
|
|
118
118
|
new HarmonyModulesPlugin_1.default({
|
|
119
|
-
topLevelAwait: options.experiments.topLevelAwait
|
|
119
|
+
topLevelAwait: options.experiments.topLevelAwait
|
|
120
120
|
}).apply(compiler);
|
|
121
121
|
new CommonJsPlugin_1.default().apply(compiler);
|
|
122
122
|
new LoaderPlugin_1.default({}).apply(compiler);
|
|
123
123
|
new APIPlugin_1.default({
|
|
124
|
-
module: options.output.module
|
|
124
|
+
module: options.output.module
|
|
125
125
|
}).apply(compiler);
|
|
126
|
-
new ExportsInfoApiPlugin_1.default().apply(compiler);
|
|
127
|
-
// new WebpackIsIncludedPlugin().apply(compiler)
|
|
128
|
-
new ConstPlugin_1.default().apply(compiler);
|
|
129
126
|
new UseStrictPlugin_1.default().apply(compiler);
|
|
130
127
|
new ImportPlugin_1.default().apply(compiler);
|
|
131
128
|
new ImportMetaContextPlugin_1.default().apply(compiler);
|
|
132
129
|
new ImportMetaPlugin_1.default().apply(compiler);
|
|
133
130
|
new URLPlugin_1.default().apply(compiler);
|
|
131
|
+
new CompatibilityPlugin_1.default().apply(compiler);
|
|
132
|
+
// new MPPackIsIncludedPlugin().apply(compiler)
|
|
133
|
+
new ConstPlugin_1.default().apply(compiler);
|
|
134
134
|
options.node = { global: true, __filename: 'mock', __dirname: 'mock' };
|
|
135
135
|
new NodeStuffPlugin_1.default(options.node).apply(compiler);
|
|
136
136
|
new DefaultStatsFactoryPlugin_1.default().apply(compiler);
|
|
137
137
|
new DefaultStatsPresetPlugin_1.default().apply(compiler);
|
|
138
138
|
new DefaultStatsPrinterPlugin_1.default().apply(compiler);
|
|
139
|
-
new JavascriptMetaInfoPlugin_1.default().apply(compiler);
|
|
140
139
|
this.setupEntryPlugins(compiler, options);
|
|
141
140
|
this.setupIdPlugins(compiler, options);
|
|
142
141
|
this.setupOptimizePlugins(compiler, options);
|
|
143
142
|
new TemplatedPathPlugin_1.default().apply(compiler);
|
|
144
143
|
new RecordIdsPlugin_1.default({
|
|
145
|
-
portableIds: options.optimization.portableRecords
|
|
144
|
+
portableIds: options.optimization.portableRecords
|
|
146
145
|
}).apply(compiler);
|
|
147
146
|
new WarnCaseSensitiveModulesPlugin_1.default().apply(compiler);
|
|
148
147
|
new AddManagedPathsPlugin_1.default(options.snapshot.managedPaths, options.snapshot.immutablePaths).apply(compiler);
|
|
@@ -150,29 +149,7 @@ class PluginManager {
|
|
|
150
149
|
if (!compiler.inputFileSystem) {
|
|
151
150
|
throw new Error('No input filesystem provided');
|
|
152
151
|
}
|
|
153
|
-
compiler
|
|
154
|
-
.for('normal')
|
|
155
|
-
.tap('PluginManager', resolveOptions => {
|
|
156
|
-
resolveOptions = (0, cleverMerge_1.cleverMerge)(options.resolve, resolveOptions);
|
|
157
|
-
resolveOptions.fileSystem = compiler.inputFileSystem;
|
|
158
|
-
return resolveOptions;
|
|
159
|
-
});
|
|
160
|
-
compiler.resolverFactory.hooks.resolveOptions
|
|
161
|
-
.for('context')
|
|
162
|
-
.tap('PluginManager', resolveOptions => {
|
|
163
|
-
resolveOptions = (0, cleverMerge_1.cleverMerge)(options.resolve, resolveOptions);
|
|
164
|
-
resolveOptions.fileSystem = compiler.inputFileSystem;
|
|
165
|
-
resolveOptions.resolveToContext = true;
|
|
166
|
-
return resolveOptions;
|
|
167
|
-
});
|
|
168
|
-
compiler.resolverFactory.hooks.resolveOptions
|
|
169
|
-
.for('loader')
|
|
170
|
-
.tap('PluginManager', resolveOptions => {
|
|
171
|
-
resolveOptions = (0, cleverMerge_1.cleverMerge)(options.resolveLoader, resolveOptions);
|
|
172
|
-
resolveOptions.fileSystem = compiler.inputFileSystem;
|
|
173
|
-
return resolveOptions;
|
|
174
|
-
});
|
|
175
|
-
compiler.hooks.afterResolvers.call(compiler);
|
|
152
|
+
this.setupResolver(compiler, options);
|
|
176
153
|
return options;
|
|
177
154
|
}
|
|
178
155
|
setupIdPlugins(compiler, options) {
|
|
@@ -221,7 +198,7 @@ class PluginManager {
|
|
|
221
198
|
if (isFinite(options.maxGenerations)) {
|
|
222
199
|
const MemoryWithGcCachePlugin = require('./cache/MemoryWithGcCachePlugin').default;
|
|
223
200
|
new MemoryWithGcCachePlugin({
|
|
224
|
-
maxGenerations: options.maxGenerations
|
|
201
|
+
maxGenerations: options.maxGenerations
|
|
225
202
|
}).apply(compiler);
|
|
226
203
|
}
|
|
227
204
|
else {
|
|
@@ -234,42 +211,62 @@ class PluginManager {
|
|
|
234
211
|
}
|
|
235
212
|
compiler.moduleMemCaches = new Map();
|
|
236
213
|
}
|
|
237
|
-
// filesystem
|
|
238
214
|
const cacheOptions = options.cache;
|
|
239
215
|
for (const key in cacheOptions.buildDependencies) {
|
|
240
216
|
const list = cacheOptions.buildDependencies[key];
|
|
241
217
|
new AddBuildDependenciesPlugin_1.default(list).apply(compiler);
|
|
242
218
|
}
|
|
243
219
|
if (!isFinite(cacheOptions.maxMemoryGenerations)) {
|
|
244
|
-
|
|
220
|
+
const MemoryCachePlugin = require('./cache/MemoryCachePlugin').default;
|
|
221
|
+
new MemoryCachePlugin().apply(compiler);
|
|
245
222
|
}
|
|
246
223
|
else if (cacheOptions.maxMemoryGenerations !== 0) {
|
|
247
|
-
|
|
248
|
-
|
|
224
|
+
const MemoryWithGcCachePlugin = require('./cache/MemoryWithGcCachePlugin').default;
|
|
225
|
+
new MemoryWithGcCachePlugin({
|
|
226
|
+
maxGenerations: cacheOptions.maxMemoryGenerations
|
|
249
227
|
}).apply(compiler);
|
|
250
228
|
}
|
|
251
|
-
//
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
//
|
|
269
|
-
|
|
270
|
-
|
|
229
|
+
// pack
|
|
230
|
+
const IdleFileCachePlugin = require('./cache/IdleFileCachePlugin').default;
|
|
231
|
+
const PackFileCacheStrategy = require('./cache/PackFileCacheStrategy').default;
|
|
232
|
+
new IdleFileCachePlugin(new PackFileCacheStrategy({
|
|
233
|
+
compiler,
|
|
234
|
+
fs: compiler.intermediateFileSystem,
|
|
235
|
+
context: options.context,
|
|
236
|
+
cacheLocation: cacheOptions.cacheLocation,
|
|
237
|
+
version: cacheOptions.version,
|
|
238
|
+
logger: compiler.getInfrastructureLogger('webpack.cache.PackFileCacheStrategy'),
|
|
239
|
+
snapshot: options.snapshot,
|
|
240
|
+
maxAge: cacheOptions.maxAge,
|
|
241
|
+
profile: cacheOptions.profile,
|
|
242
|
+
allowCollectingMemory: cacheOptions.allowCollectingMemory,
|
|
243
|
+
compression: cacheOptions.compression,
|
|
244
|
+
readonly: cacheOptions.readonly
|
|
245
|
+
}), cacheOptions.idleTimeout, cacheOptions.idleTimeoutForInitialStore, cacheOptions.idleTimeoutAfterLargeChanges).apply(compiler);
|
|
246
|
+
// resolver cache
|
|
247
|
+
const ResolverCachePlugin = require('./cache/ResolverCachePlugin').default;
|
|
248
|
+
new ResolverCachePlugin().apply(compiler);
|
|
271
249
|
}
|
|
272
250
|
}
|
|
251
|
+
setupResolver(compiler, options) {
|
|
252
|
+
compiler.resolverFactory.hooks.resolveOptions.for('normal').tap('PluginManager', resolveOptions => {
|
|
253
|
+
resolveOptions = (0, cleverMerge_1.cleverMerge)(options.resolve, resolveOptions);
|
|
254
|
+
resolveOptions.fileSystem = compiler.inputFileSystem;
|
|
255
|
+
return resolveOptions;
|
|
256
|
+
});
|
|
257
|
+
compiler.resolverFactory.hooks.resolveOptions.for('context').tap('PluginManager', resolveOptions => {
|
|
258
|
+
resolveOptions = (0, cleverMerge_1.cleverMerge)(options.resolve, resolveOptions);
|
|
259
|
+
resolveOptions.fileSystem = compiler.inputFileSystem;
|
|
260
|
+
resolveOptions.resolveToContext = true;
|
|
261
|
+
return resolveOptions;
|
|
262
|
+
});
|
|
263
|
+
compiler.resolverFactory.hooks.resolveOptions.for('loader').tap('PluginManager', resolveOptions => {
|
|
264
|
+
resolveOptions = (0, cleverMerge_1.cleverMerge)(options.resolveLoader, resolveOptions);
|
|
265
|
+
resolveOptions.fileSystem = compiler.inputFileSystem;
|
|
266
|
+
return resolveOptions;
|
|
267
|
+
});
|
|
268
|
+
compiler.hooks.afterResolvers.call(compiler);
|
|
269
|
+
}
|
|
273
270
|
setupSourceMapPlugins(compiler, options) {
|
|
274
271
|
if (options.devtool) {
|
|
275
272
|
if (options.devtool.includes('source-map')) {
|
|
@@ -288,13 +285,13 @@ class PluginManager {
|
|
|
288
285
|
module: moduleMaps ? true : !cheap,
|
|
289
286
|
columns: !cheap,
|
|
290
287
|
noSources,
|
|
291
|
-
namespace: options.output.devtoolNamespace
|
|
288
|
+
namespace: options.output.devtoolNamespace
|
|
292
289
|
}).apply(compiler);
|
|
293
290
|
}
|
|
294
291
|
else if (options.devtool.includes('eval')) {
|
|
295
292
|
new EvalDevToolModulePlugin_1.default({
|
|
296
293
|
moduleFilenameTemplate: options.output.devtoolModuleFilenameTemplate,
|
|
297
|
-
namespace: options.output.devtoolNamespace
|
|
294
|
+
namespace: options.output.devtoolNamespace
|
|
298
295
|
}).apply(compiler);
|
|
299
296
|
}
|
|
300
297
|
}
|
|
@@ -346,7 +343,7 @@ class PluginManager {
|
|
|
346
343
|
if (options.optimization.realContentHash) {
|
|
347
344
|
new RealContentHashPlugin_1.default({
|
|
348
345
|
hashFunction: options.output.hashFunction,
|
|
349
|
-
hashDigest: options.output.hashDigest
|
|
346
|
+
hashDigest: options.output.hashDigest
|
|
350
347
|
}).apply(compiler);
|
|
351
348
|
}
|
|
352
349
|
if (options.optimization.minimize) {
|
package/dist/Template.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ConcatSource, PrefixSource } from 'webpack-sources';
|
|
2
2
|
import Module from './module/Module';
|
|
3
|
-
import RuntimeModule from './module/RuntimeModule';
|
|
3
|
+
import RuntimeModule from './module/runtime/RuntimeModule';
|
|
4
4
|
declare const NUMBER_OF_IDENTIFIER_START_CHARS: number;
|
|
5
5
|
declare const NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS: number;
|
|
6
6
|
interface WithId {
|