@ohos-ports/rspack-core 2.2.2-beta.0
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/LICENSE +22 -0
- package/README.md +15 -0
- package/compiled/@rspack/lite-tapable/dist/index.d.ts +176 -0
- package/compiled/@rspack/lite-tapable/license +22 -0
- package/compiled/@rspack/lite-tapable/package.json +1 -0
- package/compiled/@swc/types/index.d.ts +2284 -0
- package/compiled/@swc/types/index.js +19 -0
- package/compiled/@swc/types/license +201 -0
- package/compiled/@swc/types/package.json +1 -0
- package/compiled/connect-next/index.d.ts +57 -0
- package/compiled/connect-next/license +26 -0
- package/compiled/connect-next/package.json +1 -0
- package/compiled/http-proxy-middleware/index.d.ts +455 -0
- package/compiled/http-proxy-middleware/license +22 -0
- package/compiled/http-proxy-middleware/package.json +1 -0
- package/compiled/open/index.d.ts +161 -0
- package/compiled/open/package.json +1 -0
- package/compiled/tinypool/LICENSE +24 -0
- package/compiled/tinypool/README.md +214 -0
- package/compiled/tinypool/dist/common-Bo3KCGim.js +31 -0
- package/compiled/tinypool/dist/entry/process.d.ts +1 -0
- package/compiled/tinypool/dist/entry/process.js +72 -0
- package/compiled/tinypool/dist/entry/utils.d.ts +7 -0
- package/compiled/tinypool/dist/entry/utils.js +3 -0
- package/compiled/tinypool/dist/entry/worker.d.ts +1 -0
- package/compiled/tinypool/dist/entry/worker.js +76 -0
- package/compiled/tinypool/dist/index.d.ts +199 -0
- package/compiled/tinypool/dist/index.js +784 -0
- package/compiled/tinypool/dist/utils-B--2TaWv.js +38 -0
- package/compiled/tinypool/dist/utils-De75vAgL.js +10 -0
- package/compiled/tinypool/package.json +55 -0
- package/compiled/watchpack/index.d.ts +3 -0
- package/compiled/watchpack/index.js +3811 -0
- package/compiled/watchpack/license +20 -0
- package/compiled/watchpack/package.json +8 -0
- package/compiled/watchpack/types/DirectoryWatcher.d.ts +335 -0
- package/compiled/watchpack/types/LinkResolver.d.ts +10 -0
- package/compiled/watchpack/types/getWatcherManager.d.ts +62 -0
- package/compiled/watchpack/types/index.d.ts +269 -0
- package/compiled/watchpack/types/reducePlan.d.ts +34 -0
- package/compiled/watchpack/types/util/globToRegExp.d.ts +2 -0
- package/compiled/watchpack/types/watchEventSource.d.ts +53 -0
- package/compiled/watchpack/types/watchpack.d.ts +2 -0
- package/compiled/webpack-sources/index.js +5835 -0
- package/compiled/webpack-sources/license +21 -0
- package/compiled/webpack-sources/package.json +1 -0
- package/compiled/webpack-sources/types.d.ts +500 -0
- package/dist/612~0.js +32 -0
- package/dist/612~3.js +32 -0
- package/dist/BuildInfo.d.ts +17 -0
- package/dist/Chunk.d.ts +16 -0
- package/dist/ChunkGraph.d.ts +9 -0
- package/dist/Chunks.d.ts +12 -0
- package/dist/CodeGenerationResults.d.ts +1 -0
- package/dist/Compilation.d.ts +448 -0
- package/dist/Compiler.d.ts +229 -0
- package/dist/ConcatenatedModule.d.ts +1 -0
- package/dist/ContextModule.d.ts +1 -0
- package/dist/ContextModuleFactory.d.ts +13 -0
- package/dist/Diagnostics.d.ts +7 -0
- package/dist/Entrypoint.d.ts +2 -0
- package/dist/ErrorHelpers.d.ts +3 -0
- package/dist/ExecuteModulePlugin.d.ts +4 -0
- package/dist/ExportsInfo.d.ts +20 -0
- package/dist/ExternalModule.d.ts +15 -0
- package/dist/FileSystem.d.ts +54 -0
- package/dist/FileSystemInfo.d.ts +5 -0
- package/dist/Module.d.ts +41 -0
- package/dist/ModuleGraph.d.ts +22 -0
- package/dist/ModuleGraphConnection.d.ts +10 -0
- package/dist/ModuleTypeConstants.d.ts +8 -0
- package/dist/MultiCompiler.d.ts +82 -0
- package/dist/MultiStats.d.ts +23 -0
- package/dist/MultiWatching.d.ts +27 -0
- package/dist/NativeWatchFileSystem.d.ts +52 -0
- package/dist/NormalModule.d.ts +14 -0
- package/dist/NormalModuleFactory.d.ts +23 -0
- package/dist/Resolver.d.ts +30 -0
- package/dist/ResolverFactory.d.ts +17 -0
- package/dist/RspackError.d.ts +12 -0
- package/dist/RuleSetCompiler.d.ts +9 -0
- package/dist/RuntimeGlobals.d.ts +360 -0
- package/dist/RuntimeModule.d.ts +34 -0
- package/dist/RuntimeTemplate.d.ts +151 -0
- package/dist/Stats.d.ts +17 -0
- package/dist/Template.d.ts +77 -0
- package/dist/VirtualModulesPlugin.d.ts +12 -0
- package/dist/Watching.d.ts +56 -0
- package/dist/builtin-loader/lightningcss/index.d.ts +114 -0
- package/dist/builtin-loader/lightningcss/target.d.ts +4 -0
- package/dist/builtin-loader/swc/collectTypeScriptInfo.d.ts +21 -0
- package/dist/builtin-loader/swc/index.d.ts +3 -0
- package/dist/builtin-loader/swc/pluginImport.d.ts +33 -0
- package/dist/builtin-loader/swc/types.d.ts +60 -0
- package/dist/builtin-plugin/APIPlugin.d.ts +9 -0
- package/dist/builtin-plugin/ArrayPushCallbackChunkFormatPlugin.d.ts +9 -0
- package/dist/builtin-plugin/AssetModulesPlugin.d.ts +9 -0
- package/dist/builtin-plugin/AsyncWebAssemblyModulesPlugin.d.ts +9 -0
- package/dist/builtin-plugin/BannerPlugin.d.ts +40 -0
- package/dist/builtin-plugin/BundlerInfoRspackPlugin.d.ts +14 -0
- package/dist/builtin-plugin/CaseSensitivePlugin.d.ts +9 -0
- package/dist/builtin-plugin/ChunkPrefetchPreloadPlugin.d.ts +9 -0
- package/dist/builtin-plugin/CircularCheckRspackPlugin.d.ts +33 -0
- package/dist/builtin-plugin/CircularDependencyRspackPlugin.d.ts +60 -0
- package/dist/builtin-plugin/CircularModulesInfoPlugin.d.ts +7 -0
- package/dist/builtin-plugin/CommonJsChunkFormatPlugin.d.ts +9 -0
- package/dist/builtin-plugin/CompactHashedChunkIdsPlugin.d.ts +12 -0
- package/dist/builtin-plugin/CompactHashedModuleIdsPlugin.d.ts +12 -0
- package/dist/builtin-plugin/ContextReplacementPlugin.d.ts +9 -0
- package/dist/builtin-plugin/CopyRspackPlugin.d.ts +14 -0
- package/dist/builtin-plugin/CssChunkingPlugin.d.ts +21 -0
- package/dist/builtin-plugin/CssHttpExternalsRspackPlugin.d.ts +9 -0
- package/dist/builtin-plugin/CssModulesPlugin.d.ts +9 -0
- package/dist/builtin-plugin/DataUriPlugin.d.ts +9 -0
- package/dist/builtin-plugin/DefinePlugin.d.ts +16 -0
- package/dist/builtin-plugin/DeterministicChunkIdsPlugin.d.ts +7 -0
- package/dist/builtin-plugin/DeterministicModuleIdsPlugin.d.ts +18 -0
- package/dist/builtin-plugin/DllEntryPlugin.d.ts +12 -0
- package/dist/builtin-plugin/DllReferenceAgencyPlugin.d.ts +11 -0
- package/dist/builtin-plugin/DynamicEntryPlugin.d.ts +12 -0
- package/dist/builtin-plugin/ElectronTargetPlugin.d.ts +9 -0
- package/dist/builtin-plugin/EnableChunkLoadingPlugin.d.ts +25 -0
- package/dist/builtin-plugin/EnableLibraryPlugin.d.ts +11 -0
- package/dist/builtin-plugin/EnableWasmLoadingPlugin.d.ts +9 -0
- package/dist/builtin-plugin/EnsureChunkConditionsPlugin.d.ts +9 -0
- package/dist/builtin-plugin/EntryPlugin.d.ts +32 -0
- package/dist/builtin-plugin/EsmLibraryPlugin.d.ts +16 -0
- package/dist/builtin-plugin/EsmNodeTargetPlugin.d.ts +9 -0
- package/dist/builtin-plugin/EvalDevToolModulePlugin.d.ts +11 -0
- package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.d.ts +10 -0
- package/dist/builtin-plugin/ExternalsPlugin.d.ts +13 -0
- package/dist/builtin-plugin/FetchCompileAsyncWasmPlugin.d.ts +9 -0
- package/dist/builtin-plugin/FileUriPlugin.d.ts +9 -0
- package/dist/builtin-plugin/FlagAllModulesAsUsedPlugin.d.ts +9 -0
- package/dist/builtin-plugin/FlagDependencyExportsPlugin.d.ts +9 -0
- package/dist/builtin-plugin/FlagDependencyUsagePlugin.d.ts +9 -0
- package/dist/builtin-plugin/HashedModuleIdsPlugin.d.ts +10 -0
- package/dist/builtin-plugin/HotModuleReplacementPlugin.d.ts +7 -0
- package/dist/builtin-plugin/HttpExternalsRspackPlugin.d.ts +9 -0
- package/dist/builtin-plugin/HttpUriPlugin.d.ts +36 -0
- package/dist/builtin-plugin/IgnorePlugin.d.ts +19 -0
- package/dist/builtin-plugin/InferAsyncModulesPlugin.d.ts +9 -0
- package/dist/builtin-plugin/InlineExportsPlugin.d.ts +9 -0
- package/dist/builtin-plugin/JavascriptModulesPlugin.d.ts +30 -0
- package/dist/builtin-plugin/JsLoaderRspackPlugin.d.ts +10 -0
- package/dist/builtin-plugin/JsonModulesPlugin.d.ts +9 -0
- package/dist/builtin-plugin/LibManifestPlugin.d.ts +17 -0
- package/dist/builtin-plugin/LightningCssMinimizerRspackPlugin.d.ts +28 -0
- package/dist/builtin-plugin/LimitChunkCountPlugin.d.ts +14 -0
- package/dist/builtin-plugin/MangleExportsPlugin.d.ts +9 -0
- package/dist/builtin-plugin/MergeDuplicateChunksPlugin.d.ts +9 -0
- package/dist/builtin-plugin/ModuleChunkFormatPlugin.d.ts +9 -0
- package/dist/builtin-plugin/ModuleConcatenationPlugin.d.ts +7 -0
- package/dist/builtin-plugin/ModuleInfoHeaderPlugin.d.ts +9 -0
- package/dist/builtin-plugin/NamedChunkIdsPlugin.d.ts +9 -0
- package/dist/builtin-plugin/NamedModuleIdsPlugin.d.ts +9 -0
- package/dist/builtin-plugin/NaturalChunkIdsPlugin.d.ts +7 -0
- package/dist/builtin-plugin/NaturalModuleIdsPlugin.d.ts +7 -0
- package/dist/builtin-plugin/NoEmitOnErrorsPlugin.d.ts +9 -0
- package/dist/builtin-plugin/NodeTargetPlugin.d.ts +9 -0
- package/dist/builtin-plugin/NormalModuleReplacementPlugin.d.ts +10 -0
- package/dist/builtin-plugin/OccurrenceChunkIdsPlugin.d.ts +10 -0
- package/dist/builtin-plugin/ProgressPlugin.d.ts +12 -0
- package/dist/builtin-plugin/ProvidePlugin.d.ts +10 -0
- package/dist/builtin-plugin/RealContentHashPlugin.d.ts +20 -0
- package/dist/builtin-plugin/RemoveDuplicateModulesPlugin.d.ts +9 -0
- package/dist/builtin-plugin/RemoveEmptyChunksPlugin.d.ts +9 -0
- package/dist/builtin-plugin/RsdoctorPlugin.d.ts +46 -0
- package/dist/builtin-plugin/RslibPlugin.d.ts +10 -0
- package/dist/builtin-plugin/RstestPlugin.d.ts +10 -0
- package/dist/builtin-plugin/RuntimeChunkPlugin.d.ts +11 -0
- package/dist/builtin-plugin/RuntimePlugin.d.ts +25 -0
- package/dist/builtin-plugin/SideEffectsFlagPlugin.d.ts +9 -0
- package/dist/builtin-plugin/SizeLimitsPlugin.d.ts +19 -0
- package/dist/builtin-plugin/SourceMapDevToolPlugin.d.ts +11 -0
- package/dist/builtin-plugin/SplitChunksPlugin.d.ts +12 -0
- package/dist/builtin-plugin/SubresourceIntegrityPlugin.d.ts +39 -0
- package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +216 -0
- package/dist/builtin-plugin/SyncModuleIdsPlugin.d.ts +16 -0
- package/dist/builtin-plugin/URLPlugin.d.ts +9 -0
- package/dist/builtin-plugin/WorkerPlugin.d.ts +14 -0
- package/dist/builtin-plugin/base.d.ts +45 -0
- package/dist/builtin-plugin/css-extract/index.d.ts +24 -0
- package/dist/builtin-plugin/css-extract/loader.d.ts +21 -0
- package/dist/builtin-plugin/css-extract/utils.d.ts +10 -0
- package/dist/builtin-plugin/html-plugin/hooks.d.ts +32 -0
- package/dist/builtin-plugin/html-plugin/index.d.ts +2 -0
- package/dist/builtin-plugin/html-plugin/options.d.ts +77 -0
- package/dist/builtin-plugin/html-plugin/plugin.d.ts +20 -0
- package/dist/builtin-plugin/html-plugin/taps.d.ts +2 -0
- package/dist/builtin-plugin/index.d.ts +92 -0
- package/dist/builtin-plugin/lazy-compilation/lazyCompilation.d.ts +10 -0
- package/dist/builtin-plugin/lazy-compilation/middleware.d.ts +12 -0
- package/dist/builtin-plugin/rsc/Coordinator.d.ts +8 -0
- package/dist/builtin-plugin/rsc/RscClientPlugin.d.ts +13 -0
- package/dist/builtin-plugin/rsc/RscServerPlugin.d.ts +47 -0
- package/dist/builtin-plugin/rsc/index.d.ts +24 -0
- package/dist/checkNodeVersion.d.ts +1 -0
- package/dist/config/adapter.d.ts +8 -0
- package/dist/config/adapterRuleUse.d.ts +424 -0
- package/dist/config/browserslistTargetHandler.d.ts +15 -0
- package/dist/config/defaults.d.ts +15 -0
- package/dist/config/devServer.d.ts +179 -0
- package/dist/config/index.d.ts +5 -0
- package/dist/config/normalization.d.ts +156 -0
- package/dist/config/target.d.ts +100 -0
- package/dist/config/types.d.ts +2728 -0
- package/dist/container/ContainerPlugin.d.ts +41 -0
- package/dist/container/ContainerReferencePlugin.d.ts +34 -0
- package/dist/container/ModuleFederationManifestPlugin.d.ts +44 -0
- package/dist/container/ModuleFederationPlugin.d.ts +34 -0
- package/dist/container/ModuleFederationPluginV1.d.ts +22 -0
- package/dist/container/ModuleFederationRuntimePlugin.d.ts +16 -0
- package/dist/container/options.d.ts +3 -0
- package/dist/cssExtractHmr.js +99 -0
- package/dist/cssExtractLoader.js +117 -0
- package/dist/error/ConcurrentCompilationError.d.ts +14 -0
- package/dist/exports.d.ts +192 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +14552 -0
- package/dist/lib/AbstractMethodError.d.ts +23 -0
- package/dist/lib/Cache.d.ts +65 -0
- package/dist/lib/CacheFacade.d.ts +139 -0
- package/dist/lib/DllPlugin.d.ts +42 -0
- package/dist/lib/DllReferencePlugin.d.ts +119 -0
- package/dist/lib/EntryOptionPlugin.d.ts +33 -0
- package/dist/lib/EnvironmentPlugin.d.ts +22 -0
- package/dist/lib/HookWebpackError.d.ts +39 -0
- package/dist/lib/IgnoreWarningsPlugin.d.ts +25 -0
- package/dist/lib/LoaderOptionsPlugin.d.ts +28 -0
- package/dist/lib/LoaderTargetPlugin.d.ts +24 -0
- package/dist/lib/ModuleFilenameHelpers.d.ts +53 -0
- package/dist/lib/WebpackError.d.ts +21 -0
- package/dist/lib/cache/MemoryCachePlugin.d.ts +5 -0
- package/dist/lib/cache/getLazyHashedEtag.d.ts +35 -0
- package/dist/lib/cache/mergeEtags.d.ts +16 -0
- package/dist/loader-runner/LoaderLoadingError.d.ts +13 -0
- package/dist/loader-runner/ModuleError.d.ts +13 -0
- package/dist/loader-runner/cache.d.ts +18 -0
- package/dist/loader-runner/dependencies.d.ts +22 -0
- package/dist/loader-runner/index.d.ts +35 -0
- package/dist/loader-runner/loadLoader.d.ts +12 -0
- package/dist/loader-runner/service.d.ts +77 -0
- package/dist/loader-runner/utils.d.ts +7 -0
- package/dist/loader-runner/worker.d.ts +14 -0
- package/dist/logging/Logger.d.ts +61 -0
- package/dist/logging/createConsoleLogger.d.ts +35 -0
- package/dist/logging/truncateArgs.d.ts +16 -0
- package/dist/moduleFederationDefaultRuntime.js +1 -0
- package/dist/node/NodeEnvironmentPlugin.d.ts +10 -0
- package/dist/node/NodeTemplatePlugin.d.ts +18 -0
- package/dist/node/NodeWatchFileSystem.d.ts +30 -0
- package/dist/node/nodeConsole.d.ts +15 -0
- package/dist/rspack.d.ts +24 -0
- package/dist/rspackOptionsApply.d.ts +4 -0
- package/dist/runtime/cssExtractHmr.d.ts +4 -0
- package/dist/runtime/moduleFederationDefaultRuntime.d.ts +1 -0
- package/dist/sharing/CollectSharedEntryPlugin.d.ts +22 -0
- package/dist/sharing/ConsumeSharedPlugin.d.ts +54 -0
- package/dist/sharing/IndependentSharedPlugin.d.ts +37 -0
- package/dist/sharing/ProvideSharedPlugin.d.ts +54 -0
- package/dist/sharing/SharePlugin.d.ts +89 -0
- package/dist/sharing/ShareRuntimePlugin.d.ts +9 -0
- package/dist/sharing/SharedContainerPlugin.d.ts +23 -0
- package/dist/sharing/SharedUsedExportsOptimizerPlugin.d.ts +14 -0
- package/dist/sharing/TreeShakingSharedPlugin.d.ts +19 -0
- package/dist/sharing/utils.d.ts +2 -0
- package/dist/stats/DefaultStatsFactoryPlugin.d.ts +20 -0
- package/dist/stats/DefaultStatsPresetPlugin.d.ts +4 -0
- package/dist/stats/DefaultStatsPrinterPlugin.d.ts +13 -0
- package/dist/stats/StatsFactory.d.ts +57 -0
- package/dist/stats/StatsPrinter.d.ts +57 -0
- package/dist/stats/statsFactoryUtils.d.ts +338 -0
- package/dist/swc.d.ts +7 -0
- package/dist/taps/compilation.d.ts +8 -0
- package/dist/taps/compiler.d.ts +2 -0
- package/dist/taps/contextModuleFactory.d.ts +2 -0
- package/dist/taps/externalModule.d.ts +2 -0
- package/dist/taps/index.d.ts +7 -0
- package/dist/taps/javascriptModules.d.ts +2 -0
- package/dist/taps/normalModuleFactory.d.ts +2 -0
- package/dist/taps/types.d.ts +11 -0
- package/dist/trace/index.d.ts +47 -0
- package/dist/trace/traceHookPlugin.d.ts +5 -0
- package/dist/util/ArrayQueue.d.ts +45 -0
- package/dist/util/AsyncTask.d.ts +7 -0
- package/dist/util/MergeCaller.d.ts +10 -0
- package/dist/util/SizeFormatHelpers.d.ts +10 -0
- package/dist/util/SplitChunkSize.d.ts +5 -0
- package/dist/util/assertNotNil.d.ts +1 -0
- package/dist/util/assetCondition.d.ts +2 -0
- package/dist/util/asyncLib.d.ts +54 -0
- package/dist/util/bindingVersionCheck.d.ts +5 -0
- package/dist/util/cleverMerge.d.ts +24 -0
- package/dist/util/comparators.d.ts +16 -0
- package/dist/util/createHash.d.ts +16 -0
- package/dist/util/createReadonlyMap.d.ts +1 -0
- package/dist/util/fake.d.ts +11 -0
- package/dist/util/fs.d.ts +376 -0
- package/dist/util/hash/index.d.ts +26 -0
- package/dist/util/hash/md4.d.ts +11 -0
- package/dist/util/hash/wasm-hash.d.ts +51 -0
- package/dist/util/hash/xxhash64.d.ts +11 -0
- package/dist/util/identifier.d.ts +57 -0
- package/dist/util/index.d.ts +9 -0
- package/dist/util/memoize.d.ts +2 -0
- package/dist/util/runtime.d.ts +2 -0
- package/dist/util/smartGrouping.d.ts +21 -0
- package/dist/util/source.d.ts +6 -0
- package/dist/util/supportsColor.d.ts +6 -0
- package/dist/util/targetsVersion.d.ts +2 -0
- package/dist/util/validateConfig.d.ts +5 -0
- package/dist/web/JsonpTemplatePlugin.d.ts +13 -0
- package/dist/webworker/WebWorkerTemplatePlugin.d.ts +13 -0
- package/dist/worker.js +971 -0
- package/hot/dev-server.js +76 -0
- package/hot/emitter.js +23 -0
- package/hot/lazy-compilation-node.js +109 -0
- package/hot/lazy-compilation-web.js +97 -0
- package/hot/log-apply-result.js +52 -0
- package/hot/log.js +87 -0
- package/hot/only-dev-server.js +104 -0
- package/hot/poll.js +41 -0
- package/hot/signal.js +68 -0
- package/module.d.ts +310 -0
- package/package.json +79 -0
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The following code is modified based on
|
|
3
|
+
* https://github.com/webpack/webpack/blob/v5.88.2/lib/RuntimeGlobals.js
|
|
4
|
+
*
|
|
5
|
+
* MIT Licensed
|
|
6
|
+
* Author Tobias Koppers \@sokra
|
|
7
|
+
* Copyright (c) JS Foundation and other contributors
|
|
8
|
+
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
9
|
+
*/
|
|
10
|
+
import type { JsRuntimeGlobals } from '@ohos-ports/rspack-binding';
|
|
11
|
+
import type { RspackOptionsNormalized } from './config/index.js';
|
|
12
|
+
export declare function __from_binding_runtime_globals(runtimeRequirements: JsRuntimeGlobals, compilerRuntimeGlobals: Record<string, string>): Set<string>;
|
|
13
|
+
export declare function __to_binding_runtime_globals(runtimeRequirements: Set<string>, compilerRuntimeGlobals: Record<string, string>): JsRuntimeGlobals;
|
|
14
|
+
declare enum RuntimeGlobals {
|
|
15
|
+
/**
|
|
16
|
+
* the internal require function
|
|
17
|
+
*/
|
|
18
|
+
require = 0,
|
|
19
|
+
/**
|
|
20
|
+
* access to properties of the internal require function/object
|
|
21
|
+
*/
|
|
22
|
+
requireScope = 1,
|
|
23
|
+
/**
|
|
24
|
+
* the internal exports object
|
|
25
|
+
*/
|
|
26
|
+
exports = 2,
|
|
27
|
+
/**
|
|
28
|
+
* top-level this need to be the exports object
|
|
29
|
+
*/
|
|
30
|
+
thisAsExports = 3,
|
|
31
|
+
/**
|
|
32
|
+
* runtime need to return the exports of the last entry module
|
|
33
|
+
*/
|
|
34
|
+
returnExportsFromRuntime = 4,
|
|
35
|
+
/**
|
|
36
|
+
* the internal module object
|
|
37
|
+
*/
|
|
38
|
+
module = 5,
|
|
39
|
+
/**
|
|
40
|
+
* the internal module object
|
|
41
|
+
*/
|
|
42
|
+
moduleId = 6,
|
|
43
|
+
/**
|
|
44
|
+
* the internal module object
|
|
45
|
+
*/
|
|
46
|
+
moduleLoaded = 7,
|
|
47
|
+
/**
|
|
48
|
+
* the bundle public path
|
|
49
|
+
*/
|
|
50
|
+
publicPath = 8,
|
|
51
|
+
/**
|
|
52
|
+
* the module id of the entry point
|
|
53
|
+
*/
|
|
54
|
+
entryModuleId = 9,
|
|
55
|
+
/**
|
|
56
|
+
* the module cache
|
|
57
|
+
*/
|
|
58
|
+
moduleCache = 10,
|
|
59
|
+
/**
|
|
60
|
+
* the module functions
|
|
61
|
+
*/
|
|
62
|
+
moduleFactories = 11,
|
|
63
|
+
/**
|
|
64
|
+
* the module functions, with only write access
|
|
65
|
+
*/
|
|
66
|
+
moduleFactoriesAddOnly = 12,
|
|
67
|
+
/**
|
|
68
|
+
* the chunk ensure function
|
|
69
|
+
*/
|
|
70
|
+
ensureChunk = 13,
|
|
71
|
+
/**
|
|
72
|
+
* an object with handlers to ensure a chunk
|
|
73
|
+
*/
|
|
74
|
+
ensureChunkHandlers = 14,
|
|
75
|
+
/**
|
|
76
|
+
* a runtime requirement if ensureChunkHandlers should include loading of chunk needed for entries
|
|
77
|
+
*/
|
|
78
|
+
ensureChunkIncludeEntries = 15,
|
|
79
|
+
/**
|
|
80
|
+
* the chunk prefetch function
|
|
81
|
+
*/
|
|
82
|
+
prefetchChunk = 16,
|
|
83
|
+
/**
|
|
84
|
+
* an object with handlers to prefetch a chunk
|
|
85
|
+
*/
|
|
86
|
+
prefetchChunkHandlers = 17,
|
|
87
|
+
/**
|
|
88
|
+
* the chunk preload function
|
|
89
|
+
*/
|
|
90
|
+
preloadChunk = 18,
|
|
91
|
+
/**
|
|
92
|
+
* an object with handlers to preload a chunk
|
|
93
|
+
*/
|
|
94
|
+
preloadChunkHandlers = 19,
|
|
95
|
+
/**
|
|
96
|
+
* the exported property define getters function
|
|
97
|
+
*/
|
|
98
|
+
definePropertyGetters = 20,
|
|
99
|
+
/**
|
|
100
|
+
* define compatibility on export
|
|
101
|
+
*/
|
|
102
|
+
makeNamespaceObject = 21,
|
|
103
|
+
/**
|
|
104
|
+
* create a fake namespace object
|
|
105
|
+
*/
|
|
106
|
+
createFakeNamespaceObject = 22,
|
|
107
|
+
/**
|
|
108
|
+
* compatibility get default export
|
|
109
|
+
*/
|
|
110
|
+
compatGetDefaultExport = 23,
|
|
111
|
+
/**
|
|
112
|
+
* ES modules decorator
|
|
113
|
+
*/
|
|
114
|
+
harmonyModuleDecorator = 24,
|
|
115
|
+
/**
|
|
116
|
+
* node.js module decorator
|
|
117
|
+
*/
|
|
118
|
+
nodeModuleDecorator = 25,
|
|
119
|
+
/**
|
|
120
|
+
* the webpack hash
|
|
121
|
+
*/
|
|
122
|
+
getFullHash = 26,
|
|
123
|
+
/**
|
|
124
|
+
* an object containing all installed WebAssembly.Instance export objects keyed by module id
|
|
125
|
+
*/
|
|
126
|
+
wasmInstances = 27,
|
|
127
|
+
/**
|
|
128
|
+
* instantiate a wasm instance from module exports object, id, hash and importsObject
|
|
129
|
+
*/
|
|
130
|
+
instantiateWasm = 28,
|
|
131
|
+
/**
|
|
132
|
+
* compile a wasm module from id and hash
|
|
133
|
+
*/
|
|
134
|
+
compileWasm = 29,
|
|
135
|
+
/**
|
|
136
|
+
* the uncaught error handler for the webpack runtime
|
|
137
|
+
*/
|
|
138
|
+
uncaughtErrorHandler = 30,
|
|
139
|
+
/**
|
|
140
|
+
* the script nonce
|
|
141
|
+
*/
|
|
142
|
+
scriptNonce = 31,
|
|
143
|
+
/**
|
|
144
|
+
* function to load a script tag.
|
|
145
|
+
* Arguments: (url: string, done: (event) =\> void), key?: string | number, chunkId?: string | number) =\> void
|
|
146
|
+
* done function is called when loading has finished or timeout occurred.
|
|
147
|
+
* It will attach to existing script tags with data-webpack == uniqueName + ":" + key or src == url.
|
|
148
|
+
*/
|
|
149
|
+
loadScript = 32,
|
|
150
|
+
/**
|
|
151
|
+
* function to promote a string to a TrustedScript using webpack's Trusted
|
|
152
|
+
* Types policy
|
|
153
|
+
* Arguments: (script: string) =\> TrustedScript
|
|
154
|
+
*/
|
|
155
|
+
createScript = 33,
|
|
156
|
+
/**
|
|
157
|
+
* function to promote a string to a TrustedScriptURL using webpack's Trusted
|
|
158
|
+
* Types policy
|
|
159
|
+
* Arguments: (url: string) =\> TrustedScriptURL
|
|
160
|
+
*/
|
|
161
|
+
createScriptUrl = 34,
|
|
162
|
+
/**
|
|
163
|
+
* function to return webpack's Trusted Types policy
|
|
164
|
+
* Arguments: () =\> TrustedTypePolicy
|
|
165
|
+
*/
|
|
166
|
+
getTrustedTypesPolicy = 35,
|
|
167
|
+
/**
|
|
168
|
+
* a flag when a chunk has a fetch priority
|
|
169
|
+
*/
|
|
170
|
+
hasFetchPriority = 36,
|
|
171
|
+
/**
|
|
172
|
+
* the chunk name of the chunk with the runtime
|
|
173
|
+
*/
|
|
174
|
+
chunkName = 37,
|
|
175
|
+
/**
|
|
176
|
+
* the runtime id of the current runtime
|
|
177
|
+
*/
|
|
178
|
+
runtimeId = 38,
|
|
179
|
+
/**
|
|
180
|
+
* the filename of the script part of the chunk
|
|
181
|
+
*/
|
|
182
|
+
getChunkScriptFilename = 39,
|
|
183
|
+
/**
|
|
184
|
+
* the filename of the css part of the chunk
|
|
185
|
+
*/
|
|
186
|
+
getChunkCssFilename = 40,
|
|
187
|
+
/**
|
|
188
|
+
* rspack version
|
|
189
|
+
* @internal
|
|
190
|
+
*/
|
|
191
|
+
rspackVersion = 41,
|
|
192
|
+
/**
|
|
193
|
+
* a flag when a module/chunk/tree has css modules
|
|
194
|
+
*/
|
|
195
|
+
hasCssModules = 42,
|
|
196
|
+
/**
|
|
197
|
+
* rspack unique id
|
|
198
|
+
* @internal
|
|
199
|
+
*/
|
|
200
|
+
rspackUniqueId = 43,
|
|
201
|
+
/**
|
|
202
|
+
* the filename of the script part of the hot update chunk
|
|
203
|
+
*/
|
|
204
|
+
getChunkUpdateScriptFilename = 44,
|
|
205
|
+
/**
|
|
206
|
+
* the filename of the css part of the hot update chunk
|
|
207
|
+
*/
|
|
208
|
+
getChunkUpdateCssFilename = 45,
|
|
209
|
+
/**
|
|
210
|
+
* startup signal from runtime
|
|
211
|
+
* This will be called when the runtime chunk has been loaded.
|
|
212
|
+
*/
|
|
213
|
+
startup = 46,
|
|
214
|
+
/**
|
|
215
|
+
* @deprecated
|
|
216
|
+
* creating a default startup function with the entry modules
|
|
217
|
+
*/
|
|
218
|
+
startupNoDefault = 47,
|
|
219
|
+
/**
|
|
220
|
+
* startup signal from runtime but only used to add logic after the startup
|
|
221
|
+
*/
|
|
222
|
+
startupOnlyAfter = 48,
|
|
223
|
+
/**
|
|
224
|
+
* startup signal from runtime but only used to add sync logic before the startup
|
|
225
|
+
*/
|
|
226
|
+
startupOnlyBefore = 49,
|
|
227
|
+
/**
|
|
228
|
+
* global callback functions for installing chunks
|
|
229
|
+
*/
|
|
230
|
+
chunkCallback = 50,
|
|
231
|
+
/**
|
|
232
|
+
* method to startup an entrypoint with needed chunks.
|
|
233
|
+
* Signature: (moduleId: Id, chunkIds: Id[]) =\> any.
|
|
234
|
+
* Returns the exports of the module or a Promise
|
|
235
|
+
*/
|
|
236
|
+
startupEntrypoint = 51,
|
|
237
|
+
/**
|
|
238
|
+
* startup signal from runtime for chunk dependencies
|
|
239
|
+
*/
|
|
240
|
+
startupChunkDependencies = 52,
|
|
241
|
+
/**
|
|
242
|
+
* register deferred code, which will run when certain
|
|
243
|
+
* chunks are loaded.
|
|
244
|
+
* Signature: (chunkIds: Id[], fn: () =\> any, priority: int \>= 0 = 0) =\> any
|
|
245
|
+
* Returned value will be returned directly when all chunks are already loaded
|
|
246
|
+
* When (priority & 1) it will wait for all other handlers with lower priority to
|
|
247
|
+
* be executed before itself is executed
|
|
248
|
+
*/
|
|
249
|
+
onChunksLoaded = 53,
|
|
250
|
+
/**
|
|
251
|
+
* method to install a chunk that was loaded somehow
|
|
252
|
+
* Signature: (\{ id, ids, modules, runtime \}) =\> void
|
|
253
|
+
*/
|
|
254
|
+
externalInstallChunk = 54,
|
|
255
|
+
/**
|
|
256
|
+
* interceptor for module executions
|
|
257
|
+
*/
|
|
258
|
+
interceptModuleExecution = 55,
|
|
259
|
+
/**
|
|
260
|
+
* the global object
|
|
261
|
+
*/
|
|
262
|
+
global = 56,
|
|
263
|
+
/**
|
|
264
|
+
* an object with all share scopes
|
|
265
|
+
*/
|
|
266
|
+
shareScopeMap = 57,
|
|
267
|
+
/**
|
|
268
|
+
* The sharing init sequence function (only runs once per share scope).
|
|
269
|
+
* Has one argument, the name of the share scope.
|
|
270
|
+
* Creates a share scope if not existing
|
|
271
|
+
*/
|
|
272
|
+
initializeSharing = 58,
|
|
273
|
+
/**
|
|
274
|
+
* The current scope when getting a module from a remote
|
|
275
|
+
*/
|
|
276
|
+
currentRemoteGetScope = 59,
|
|
277
|
+
/**
|
|
278
|
+
* the filename of the HMR manifest
|
|
279
|
+
*/
|
|
280
|
+
getUpdateManifestFilename = 60,
|
|
281
|
+
/**
|
|
282
|
+
* function downloading the update manifest
|
|
283
|
+
*/
|
|
284
|
+
hmrDownloadManifest = 61,
|
|
285
|
+
/**
|
|
286
|
+
* array with handler functions to download chunk updates
|
|
287
|
+
*/
|
|
288
|
+
hmrDownloadUpdateHandlers = 62,
|
|
289
|
+
/**
|
|
290
|
+
* object with all hmr module data for all modules
|
|
291
|
+
*/
|
|
292
|
+
hmrModuleData = 63,
|
|
293
|
+
/**
|
|
294
|
+
* array with handler functions when a module should be invalidated
|
|
295
|
+
*/
|
|
296
|
+
hmrInvalidateModuleHandlers = 64,
|
|
297
|
+
/**
|
|
298
|
+
* the prefix for storing state of runtime modules when hmr is enabled
|
|
299
|
+
*/
|
|
300
|
+
hmrRuntimeStatePrefix = 65,
|
|
301
|
+
/**
|
|
302
|
+
* the AMD define function
|
|
303
|
+
*/
|
|
304
|
+
amdDefine = 66,
|
|
305
|
+
/**
|
|
306
|
+
* the AMD options
|
|
307
|
+
*/
|
|
308
|
+
amdOptions = 67,
|
|
309
|
+
/**
|
|
310
|
+
* the System polyfill object
|
|
311
|
+
*/
|
|
312
|
+
system = 68,
|
|
313
|
+
/**
|
|
314
|
+
* the shorthand for Object.prototype.hasOwnProperty
|
|
315
|
+
* using of it decreases the compiled bundle size
|
|
316
|
+
*/
|
|
317
|
+
hasOwnProperty = 69,
|
|
318
|
+
/**
|
|
319
|
+
* the System.register context object
|
|
320
|
+
*/
|
|
321
|
+
systemContext = 70,
|
|
322
|
+
/**
|
|
323
|
+
* the baseURI of current document
|
|
324
|
+
*/
|
|
325
|
+
baseURI = 71,
|
|
326
|
+
/**
|
|
327
|
+
* a RelativeURL class when relative URLs are used
|
|
328
|
+
*/
|
|
329
|
+
relativeUrl = 72,
|
|
330
|
+
/**
|
|
331
|
+
* Creates an async module. The body function must be a async function.
|
|
332
|
+
* "module.exports" will be decorated with an AsyncModulePromise.
|
|
333
|
+
* The body function will be called.
|
|
334
|
+
* To handle async dependencies correctly do this: "([a, b, c] = await handleDependencies([a, b, c]));".
|
|
335
|
+
* If "hasAwaitAfterDependencies" is truthy, "handleDependencies()" must be called at the end of the body function.
|
|
336
|
+
* Signature: function(
|
|
337
|
+
* module: Module,
|
|
338
|
+
* body: (handleDependencies: (deps: AsyncModulePromise[]) =\> Promise\<any[]\> & () =\> void,
|
|
339
|
+
* hasAwaitAfterDependencies?: boolean
|
|
340
|
+
* ) =\> void
|
|
341
|
+
*/
|
|
342
|
+
asyncModule = 73,
|
|
343
|
+
asyncModuleExportSymbol = 74,
|
|
344
|
+
makeDeferredNamespaceObject = 75,
|
|
345
|
+
makeDeferredNamespaceObjectSymbol = 76
|
|
346
|
+
}
|
|
347
|
+
export declare const isReservedRuntimeGlobal: (r: string, compilerRuntimeGlobals: Record<string, string>) => boolean;
|
|
348
|
+
export declare enum RuntimeVariable {
|
|
349
|
+
Require = 0,
|
|
350
|
+
Context = 1,
|
|
351
|
+
Modules = 2,
|
|
352
|
+
ModuleCache = 3,
|
|
353
|
+
Module = 4,
|
|
354
|
+
Exports = 5,
|
|
355
|
+
StartupExec = 6
|
|
356
|
+
}
|
|
357
|
+
export declare function renderRuntimeVariables(variable: RuntimeVariable, compilerOptions?: RspackOptionsNormalized): string;
|
|
358
|
+
export declare function createCompilerRuntimeGlobals(compilerOptions?: RspackOptionsNormalized): Record<keyof typeof RuntimeGlobals, string>;
|
|
359
|
+
declare const DefaultRuntimeGlobals: Record<"amdDefine" | "amdOptions" | "asyncModule" | "asyncModuleExportSymbol" | "baseURI" | "chunkCallback" | "chunkName" | "compatGetDefaultExport" | "compileWasm" | "createFakeNamespaceObject" | "createScript" | "createScriptUrl" | "currentRemoteGetScope" | "definePropertyGetters" | "ensureChunk" | "ensureChunkHandlers" | "ensureChunkIncludeEntries" | "entryModuleId" | "exports" | "externalInstallChunk" | "getChunkCssFilename" | "getChunkScriptFilename" | "getChunkUpdateCssFilename" | "getChunkUpdateScriptFilename" | "getFullHash" | "getTrustedTypesPolicy" | "getUpdateManifestFilename" | "global" | "harmonyModuleDecorator" | "hasCssModules" | "hasFetchPriority" | "hasOwnProperty" | "hmrDownloadManifest" | "hmrDownloadUpdateHandlers" | "hmrInvalidateModuleHandlers" | "hmrModuleData" | "hmrRuntimeStatePrefix" | "initializeSharing" | "instantiateWasm" | "interceptModuleExecution" | "loadScript" | "makeDeferredNamespaceObject" | "makeDeferredNamespaceObjectSymbol" | "makeNamespaceObject" | "module" | "moduleCache" | "moduleFactories" | "moduleFactoriesAddOnly" | "moduleId" | "moduleLoaded" | "nodeModuleDecorator" | "onChunksLoaded" | "prefetchChunk" | "prefetchChunkHandlers" | "preloadChunk" | "preloadChunkHandlers" | "publicPath" | "relativeUrl" | "require" | "requireScope" | "returnExportsFromRuntime" | "rspackUniqueId" | "rspackVersion" | "runtimeId" | "scriptNonce" | "shareScopeMap" | "startup" | "startupChunkDependencies" | "startupEntrypoint" | "startupNoDefault" | "startupOnlyAfter" | "startupOnlyBefore" | "system" | "systemContext" | "thisAsExports" | "uncaughtErrorHandler" | "wasmInstances", string>;
|
|
360
|
+
export { DefaultRuntimeGlobals as RuntimeGlobals };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { JsAddingRuntimeModule, JsRuntimeModule, JsSource } from '@ohos-ports/rspack-binding';
|
|
2
|
+
import type { Chunk } from './Chunk.js';
|
|
3
|
+
import type { ChunkGraph } from './ChunkGraph.js';
|
|
4
|
+
import type { Compilation } from './Compilation.js';
|
|
5
|
+
export declare enum RuntimeModuleStage {
|
|
6
|
+
NORMAL = 0,
|
|
7
|
+
BASIC = 5,
|
|
8
|
+
ATTACH = 10,
|
|
9
|
+
TRIGGER = 20
|
|
10
|
+
}
|
|
11
|
+
export declare class RuntimeModule {
|
|
12
|
+
static STAGE_NORMAL: RuntimeModuleStage;
|
|
13
|
+
static STAGE_BASIC: RuntimeModuleStage;
|
|
14
|
+
static STAGE_ATTACH: RuntimeModuleStage;
|
|
15
|
+
static STAGE_TRIGGER: RuntimeModuleStage;
|
|
16
|
+
static __to_binding(module: RuntimeModule): JsAddingRuntimeModule;
|
|
17
|
+
private _name;
|
|
18
|
+
private _stage;
|
|
19
|
+
fullHash: boolean;
|
|
20
|
+
dependentHash: boolean;
|
|
21
|
+
protected chunk: Chunk | null;
|
|
22
|
+
protected compilation: Compilation | null;
|
|
23
|
+
protected chunkGraph: ChunkGraph | null;
|
|
24
|
+
constructor(name: string, stage?: RuntimeModuleStage);
|
|
25
|
+
attach(compilation: Compilation, chunk: Chunk, chunkGraph: ChunkGraph): void;
|
|
26
|
+
get source(): JsSource | undefined;
|
|
27
|
+
get name(): string;
|
|
28
|
+
get stage(): RuntimeModuleStage;
|
|
29
|
+
identifier(): string;
|
|
30
|
+
readableIdentifier(): string;
|
|
31
|
+
shouldIsolate(): boolean;
|
|
32
|
+
generate(): string;
|
|
33
|
+
}
|
|
34
|
+
export declare function createRenderedRuntimeModule(module: JsRuntimeModule): RuntimeModule;
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The following code is modified based on
|
|
3
|
+
* https://github.com/webpack/webpack/blob/v5.101.0/lib/RuntimeTemplate.js
|
|
4
|
+
*
|
|
5
|
+
* MIT Licensed
|
|
6
|
+
* Author Tobias Koppers @sokra
|
|
7
|
+
* Copyright (c) JS Foundation and other contributors
|
|
8
|
+
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
9
|
+
*/
|
|
10
|
+
import type { Compilation } from './Compilation.js';
|
|
11
|
+
import type { OutputNormalized } from './config/index.js';
|
|
12
|
+
export type ConcatenationArg = string | {
|
|
13
|
+
expr: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Helpers to generate runtime code that matches the capabilities of the
|
|
17
|
+
* targeted environment, available as `compilation.runtimeTemplate`.
|
|
18
|
+
*
|
|
19
|
+
* Mirrors webpack's `RuntimeTemplate`, and the environment dependent branches
|
|
20
|
+
* behave the same as `RuntimeTemplate` in
|
|
21
|
+
* `crates/rspack_core/src/runtime_template.rs`.
|
|
22
|
+
*
|
|
23
|
+
* Note: the webpack methods that render references to other modules
|
|
24
|
+
* (`moduleId`, `moduleRaw`, `moduleExports`, `moduleNamespace`,
|
|
25
|
+
* `moduleNamespacePromise`, `importStatement`, `exportFromImport`,
|
|
26
|
+
* `blockPromise`, `asyncModuleFactory`, `syncModuleFactory`, `weakError`,
|
|
27
|
+
* `runtimeConditionExpression`) are not part of this class. They need read
|
|
28
|
+
* access to the module graph and the code generation results, which Rspack
|
|
29
|
+
* keeps on the Rust side. `comment()` is omitted because Rspack has no
|
|
30
|
+
* `compilation.requestShortener`, and `defineEsModuleFlagStatement()` because
|
|
31
|
+
* Rspack renders runtime globals from a numeric `RuntimeGlobals` enum whose
|
|
32
|
+
* final identifier depends on the runtime mode.
|
|
33
|
+
*/
|
|
34
|
+
export declare class RuntimeTemplate {
|
|
35
|
+
#private;
|
|
36
|
+
compilation: Compilation;
|
|
37
|
+
outputOptions: OutputNormalized;
|
|
38
|
+
globalObject: string | undefined;
|
|
39
|
+
contentHashReplacement: string;
|
|
40
|
+
constructor(compilation: Compilation, outputOptions: OutputNormalized);
|
|
41
|
+
isIIFE(): boolean | undefined;
|
|
42
|
+
isModule(): boolean | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Matches `CompilerPlatform::is_neutral` in
|
|
45
|
+
* `crates/rspack_core/src/options/platform.rs`.
|
|
46
|
+
*/
|
|
47
|
+
isNeutralPlatform(): boolean;
|
|
48
|
+
supportsConst(): boolean;
|
|
49
|
+
supportsArrowFunction(): boolean;
|
|
50
|
+
supportsAsyncFunction(): boolean;
|
|
51
|
+
supportsOptionalChaining(): boolean;
|
|
52
|
+
supportsForOf(): boolean;
|
|
53
|
+
supportsDestructuring(): boolean;
|
|
54
|
+
supportsBigIntLiteral(): boolean;
|
|
55
|
+
supportsDynamicImport(): boolean;
|
|
56
|
+
supportsEcmaScriptModuleSyntax(): boolean;
|
|
57
|
+
supportTemplateLiteral(): boolean;
|
|
58
|
+
supportNodePrefixForCoreModules(): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* @param mod a module
|
|
61
|
+
* @returns a module with `node:` prefix when supported, otherwise an original name
|
|
62
|
+
*/
|
|
63
|
+
renderNodePrefixForCoreModule(mod: string): string;
|
|
64
|
+
/**
|
|
65
|
+
* @param returnValue return value
|
|
66
|
+
* @param args arguments
|
|
67
|
+
* @returns returning function
|
|
68
|
+
*/
|
|
69
|
+
returningFunction(returnValue: string, args?: string): string;
|
|
70
|
+
/**
|
|
71
|
+
* @param args arguments
|
|
72
|
+
* @param body body
|
|
73
|
+
* @returns basic function
|
|
74
|
+
*/
|
|
75
|
+
basicFunction(args: string, body: string | string[]): string;
|
|
76
|
+
/**
|
|
77
|
+
* @param args args
|
|
78
|
+
* @returns result expression
|
|
79
|
+
*/
|
|
80
|
+
concatenation(...args: ConcatenationArg[]): string;
|
|
81
|
+
/**
|
|
82
|
+
* @param expression expression
|
|
83
|
+
* @param args arguments
|
|
84
|
+
* @returns expression function code
|
|
85
|
+
*/
|
|
86
|
+
expressionFunction(expression: string, args?: string): string;
|
|
87
|
+
/**
|
|
88
|
+
* @returns empty function code
|
|
89
|
+
*/
|
|
90
|
+
emptyFunction(): string;
|
|
91
|
+
/**
|
|
92
|
+
* @param items items
|
|
93
|
+
* @param value value
|
|
94
|
+
* @returns destructure array code
|
|
95
|
+
*/
|
|
96
|
+
destructureArray(items: string[], value: string): string;
|
|
97
|
+
/**
|
|
98
|
+
* @param items items
|
|
99
|
+
* @param value value
|
|
100
|
+
* @returns destructure object code
|
|
101
|
+
*/
|
|
102
|
+
destructureObject(items: string[], value: string): string;
|
|
103
|
+
/**
|
|
104
|
+
* @param args arguments
|
|
105
|
+
* @param body body
|
|
106
|
+
* @returns IIFE code
|
|
107
|
+
*/
|
|
108
|
+
iife(args: string, body: string | string[]): string;
|
|
109
|
+
/**
|
|
110
|
+
* @param variable variable
|
|
111
|
+
* @param array array
|
|
112
|
+
* @param body body
|
|
113
|
+
* @returns for each code
|
|
114
|
+
*/
|
|
115
|
+
forEach(variable: string, array: string, body: string | string[]): string;
|
|
116
|
+
/**
|
|
117
|
+
* @param options generation options
|
|
118
|
+
* @returns generated error block
|
|
119
|
+
*/
|
|
120
|
+
throwMissingModuleErrorBlock({ request }: {
|
|
121
|
+
request?: string;
|
|
122
|
+
}): string;
|
|
123
|
+
/**
|
|
124
|
+
* @param options generation options
|
|
125
|
+
* @returns generated error function
|
|
126
|
+
*/
|
|
127
|
+
throwMissingModuleErrorFunction({ request }: {
|
|
128
|
+
request?: string;
|
|
129
|
+
}): string;
|
|
130
|
+
/**
|
|
131
|
+
* @param options generation options
|
|
132
|
+
* @returns generated error IIFE
|
|
133
|
+
*/
|
|
134
|
+
missingModule({ request }: {
|
|
135
|
+
request?: string;
|
|
136
|
+
}): string;
|
|
137
|
+
/**
|
|
138
|
+
* @param options generation options
|
|
139
|
+
* @returns generated error statement
|
|
140
|
+
*/
|
|
141
|
+
missingModuleStatement({ request }: {
|
|
142
|
+
request?: string;
|
|
143
|
+
}): string;
|
|
144
|
+
/**
|
|
145
|
+
* @param options generation options
|
|
146
|
+
* @returns generated error code
|
|
147
|
+
*/
|
|
148
|
+
missingModulePromise({ request }: {
|
|
149
|
+
request?: string;
|
|
150
|
+
}): string;
|
|
151
|
+
}
|
package/dist/Stats.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Compilation } from './Compilation.js';
|
|
2
|
+
import type { StatsOptions, StatsValue } from './config/index.js';
|
|
3
|
+
import type { StatsCompilation } from './stats/statsFactoryUtils.js';
|
|
4
|
+
export type { StatsAsset, StatsChunk, StatsCompilation, StatsError, StatsModule, } from './stats/statsFactoryUtils.js';
|
|
5
|
+
export declare class Stats {
|
|
6
|
+
#private;
|
|
7
|
+
constructor(compilation: Compilation);
|
|
8
|
+
get compilation(): Compilation;
|
|
9
|
+
get hash(): Readonly<string | null>;
|
|
10
|
+
get startTime(): number | undefined;
|
|
11
|
+
get endTime(): number | undefined;
|
|
12
|
+
hasErrors(): boolean;
|
|
13
|
+
hasWarnings(): boolean;
|
|
14
|
+
toJson(opts?: StatsValue, forToString?: boolean): StatsCompilation;
|
|
15
|
+
toString(opts?: StatsValue): string;
|
|
16
|
+
}
|
|
17
|
+
export declare function normalizeStatsPreset(options?: StatsValue): StatsOptions;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The following code is modified based on
|
|
3
|
+
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/Template.js
|
|
4
|
+
*
|
|
5
|
+
* MIT Licensed
|
|
6
|
+
* Author Tobias Koppers @sokra
|
|
7
|
+
* Copyright (c) JS Foundation and other contributors
|
|
8
|
+
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
9
|
+
*/
|
|
10
|
+
declare class Template {
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
* @param fn a runtime function (.runtime.js) "template"
|
|
14
|
+
* @returns the updated and normalized function string
|
|
15
|
+
*/
|
|
16
|
+
static getFunctionContent(fn: Function): string;
|
|
17
|
+
/**
|
|
18
|
+
* @param str the string converted to identifier
|
|
19
|
+
* @returns created identifier
|
|
20
|
+
*/
|
|
21
|
+
static toIdentifier(str: any): string;
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* @param str string to be converted to commented in bundle code
|
|
25
|
+
* @returns returns a commented version of string
|
|
26
|
+
*/
|
|
27
|
+
static toComment(str: string): string;
|
|
28
|
+
/**
|
|
29
|
+
*
|
|
30
|
+
* @param str string to be converted to "normal comment"
|
|
31
|
+
* @returns returns a commented version of string
|
|
32
|
+
*/
|
|
33
|
+
static toNormalComment(str: string): string;
|
|
34
|
+
/**
|
|
35
|
+
* @param str string path to be normalized
|
|
36
|
+
* @returns normalized bundle-safe path
|
|
37
|
+
*/
|
|
38
|
+
static toPath(str: string): string;
|
|
39
|
+
/**
|
|
40
|
+
* @param num number to convert to ident
|
|
41
|
+
* @returns returns single character ident
|
|
42
|
+
*/
|
|
43
|
+
static numberToIdentifier(num: number): string;
|
|
44
|
+
/**
|
|
45
|
+
* @param num number to convert to ident
|
|
46
|
+
* @returns returns single character ident
|
|
47
|
+
*/
|
|
48
|
+
static numberToIdentifierContinuation(num: number): string;
|
|
49
|
+
/**
|
|
50
|
+
*
|
|
51
|
+
* @param s string to convert to identity
|
|
52
|
+
* @returns converted identity
|
|
53
|
+
*/
|
|
54
|
+
static indent(s: string | string[]): string;
|
|
55
|
+
/**
|
|
56
|
+
*
|
|
57
|
+
* @param s string to create prefix for
|
|
58
|
+
* @param prefix prefix to compose
|
|
59
|
+
* @returns returns new prefix string
|
|
60
|
+
*/
|
|
61
|
+
static prefix(s: string | string[], prefix: string): string;
|
|
62
|
+
/**
|
|
63
|
+
*
|
|
64
|
+
* @param str string or string collection
|
|
65
|
+
* @returns returns a single string from array
|
|
66
|
+
*/
|
|
67
|
+
static asString(str: string | string[]): string;
|
|
68
|
+
/**
|
|
69
|
+
* @param modules a collection of modules to get array bounds for
|
|
70
|
+
* @returns returns the upper and lower array bounds
|
|
71
|
+
* or false if not every module has a number based id
|
|
72
|
+
*/
|
|
73
|
+
static getModulesArrayBounds(modules: {
|
|
74
|
+
id: string | number;
|
|
75
|
+
}[]): [number, number] | false;
|
|
76
|
+
}
|
|
77
|
+
export { Template };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Compiler } from './Compiler.js';
|
|
2
|
+
export declare class VirtualModulesPlugin {
|
|
3
|
+
#private;
|
|
4
|
+
constructor(modules?: Record<string, string>);
|
|
5
|
+
apply(compiler: Compiler): void;
|
|
6
|
+
writeModule(filePath: string, contents: string): void;
|
|
7
|
+
private getVirtualFileStore;
|
|
8
|
+
static __internal__take_virtual_files(compiler: Compiler): {
|
|
9
|
+
path: string;
|
|
10
|
+
content: string;
|
|
11
|
+
}[] | undefined;
|
|
12
|
+
}
|