@ohos-ports/rspack-core 2.2.9-beta.0 → 2.3.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/README.md +5 -6
- package/compiled/http-proxy-middleware/index.d.ts +10 -10
- package/compiled/http-proxy-middleware/package.json +1 -1
- package/compiled/watchpack/index.js +276 -49
- package/compiled/watchpack/package.json +1 -1
- package/compiled/watchpack/types/DirectoryWatcher.d.ts +24 -0
- package/compiled/watchpack/types/index.d.ts +1 -1
- package/compiled/watchpack/types/watchEventSource.d.ts +9 -0
- package/dist/BuildInfo.d.ts +7 -0
- package/dist/Compilation.d.ts +3 -1
- package/dist/Compiler.d.ts +5 -6
- package/dist/ConcatenatedModule.d.ts +5 -1
- package/dist/ContextModule.d.ts +3 -1
- package/dist/ExternalModule.d.ts +7 -6
- package/dist/FileSystemInfo.d.ts +1 -0
- package/dist/Module.d.ts +12 -8
- package/dist/ModuleGraphConnection.d.ts +9 -3
- package/dist/NativeWatchFileSystem.d.ts +19 -7
- package/dist/NormalModule.d.ts +14 -6
- package/dist/RuntimeTemplate.d.ts +1 -0
- package/dist/Stats.d.ts +1 -1
- package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.d.ts +3 -2
- package/dist/builtin-plugin/ImportedByDeferModulesPlugin.d.ts +9 -0
- package/dist/builtin-plugin/SubresourceIntegrityPlugin.d.ts +1 -0
- package/dist/builtin-plugin/index.d.ts +1 -0
- package/dist/builtin-plugin/lazy-compilation/lazyCompilation.d.ts +2 -2
- package/dist/config/normalization.d.ts +2 -2
- package/dist/config/target.d.ts +2 -0
- package/dist/config/types.d.ts +57 -35
- package/dist/cssExtractHmr.js +1 -1
- package/dist/exports.d.ts +3 -3
- package/dist/index.js +1140 -842
- package/dist/loader-runner/codeFilter.d.ts +9 -0
- package/dist/loader-runner/dependencies.d.ts +1 -1
- package/dist/loader-runner/index.d.ts +2 -1
- package/dist/loader-runner/service.d.ts +0 -4
- package/dist/loader-runner/worker.d.ts +4 -1
- package/dist/node/NodeWatchFileSystem.d.ts +7 -4
- package/dist/sources.d.ts +3 -0
- package/dist/stats/statsFactoryUtils.d.ts +7 -0
- package/dist/util/bindingHelpers.d.ts +2 -0
- package/dist/util/createModule.d.ts +3 -0
- package/dist/util/fs.d.ts +13 -7
- package/dist/util/resolveLayerExternals.d.ts +1 -0
- package/dist/util/source.d.ts +12 -3
- package/dist/util/symbols.d.ts +10 -0
- package/dist/util/watchTimeInfo.d.ts +5 -1
- package/dist/worker.js +323 -325
- package/hot/lazy-compilation-node.js +1 -1
- package/hot/lazy-compilation-web.js +1 -1
- package/package.json +3 -3
- package/dist/loader-runner/cache.d.ts +0 -27
package/dist/config/types.d.ts
CHANGED
|
@@ -301,6 +301,8 @@ export type Environment = {
|
|
|
301
301
|
logicalAssignment?: boolean;
|
|
302
302
|
/** The environment supports template literals. */
|
|
303
303
|
templateLiteral?: boolean;
|
|
304
|
+
/** The environment supports top-level await ('await x' at the top level of a module). */
|
|
305
|
+
topLevelAwait?: boolean;
|
|
304
306
|
};
|
|
305
307
|
export type Output = {
|
|
306
308
|
/**
|
|
@@ -640,6 +642,7 @@ export type RuleSetLogicalConditions = {
|
|
|
640
642
|
};
|
|
641
643
|
export type RuleSetLoader = string;
|
|
642
644
|
export type RuleSetLoaderOptions = string | Record<string, any>;
|
|
645
|
+
export type RuleSetLoaderCodeFilter = string | RegExp;
|
|
643
646
|
export type RuleSetLoaderWithOptions = {
|
|
644
647
|
/**
|
|
645
648
|
* Stable identifier used to reference object-form loader options.
|
|
@@ -665,6 +668,11 @@ export type RuleSetLoaderWithOptions = {
|
|
|
665
668
|
* @experimental
|
|
666
669
|
*/
|
|
667
670
|
cache?: boolean;
|
|
671
|
+
/**
|
|
672
|
+
* Filters the current input before calling the normal loader handler.
|
|
673
|
+
* The loader pitch function is not filtered.
|
|
674
|
+
*/
|
|
675
|
+
codeFilter?: RuleSetLoaderCodeFilter;
|
|
668
676
|
options?: RuleSetLoaderOptions;
|
|
669
677
|
};
|
|
670
678
|
export type RuleSetUseItem = RuleSetLoader | RuleSetLoaderWithOptions | Falsy;
|
|
@@ -693,6 +701,13 @@ export type RuleSetRuleUseAndLoader = {
|
|
|
693
701
|
};
|
|
694
702
|
/** Rule defines the conditions for matching a module and the behavior of handling those modules. */
|
|
695
703
|
export type RuleSetRule = RuleSetRuleUseAndLoader & {
|
|
704
|
+
/**
|
|
705
|
+
* Create a resource for matching subsequent rules from a path template.
|
|
706
|
+
* `[resource-path]` expands to the current matching path, including its extension.
|
|
707
|
+
* Query and fragment are preserved. The original resource is used by loaders.
|
|
708
|
+
* @experimental
|
|
709
|
+
*/
|
|
710
|
+
as?: string;
|
|
696
711
|
/** Matches all modules that match this resource, and will match against Resource. */
|
|
697
712
|
test?: RuleSetCondition;
|
|
698
713
|
/** Excludes all modules that match this condition and will match against the absolute path of the resource */
|
|
@@ -1001,6 +1016,11 @@ export type JavascriptParserOptions = {
|
|
|
1001
1016
|
* @default true
|
|
1002
1017
|
* */
|
|
1003
1018
|
url?: 'relative' | 'new-url-relative' | boolean;
|
|
1019
|
+
/**
|
|
1020
|
+
* Enable parsing of dynamic requests in new URL().
|
|
1021
|
+
* @default true
|
|
1022
|
+
*/
|
|
1023
|
+
dynamicUrl?: boolean;
|
|
1004
1024
|
/**
|
|
1005
1025
|
* Enable warnings for full dynamic dependencies
|
|
1006
1026
|
* @default true
|
|
@@ -1210,6 +1230,14 @@ export type CssGeneratorOptions = {
|
|
|
1210
1230
|
* If false, generate stylesheets and embed them in the template.
|
|
1211
1231
|
*/
|
|
1212
1232
|
exportsOnly?: CssGeneratorExportsOnly;
|
|
1233
|
+
/**
|
|
1234
|
+
* Resolve asset URLs in injected styles against the runtime public path
|
|
1235
|
+
* (`import.meta.rspackPublicPath`) instead of the build-time `output.publicPath`.
|
|
1236
|
+
* Only applies when `parser.exportType` is "style". Assets with their own
|
|
1237
|
+
* `generator.publicPath` keep that value.
|
|
1238
|
+
* @default false
|
|
1239
|
+
*/
|
|
1240
|
+
runtimePublicPath?: boolean;
|
|
1213
1241
|
/** This configuration is available for improved ESM-CJS interoperability purposes. */
|
|
1214
1242
|
esModule?: CssGeneratorEsModule;
|
|
1215
1243
|
};
|
|
@@ -1225,6 +1253,14 @@ export type CssModuleGeneratorOptions = {
|
|
|
1225
1253
|
* If false, generate stylesheets and embed them in the template.
|
|
1226
1254
|
*/
|
|
1227
1255
|
exportsOnly?: CssGeneratorExportsOnly;
|
|
1256
|
+
/**
|
|
1257
|
+
* Resolve asset URLs in injected styles against the runtime public path
|
|
1258
|
+
* (`import.meta.rspackPublicPath`) instead of the build-time `output.publicPath`.
|
|
1259
|
+
* Only applies when `parser.exportType` is "style". Assets with their own
|
|
1260
|
+
* `generator.publicPath` keep that value.
|
|
1261
|
+
* @default false
|
|
1262
|
+
*/
|
|
1263
|
+
runtimePublicPath?: boolean;
|
|
1228
1264
|
/**
|
|
1229
1265
|
* Digest types used for the hash.
|
|
1230
1266
|
*/
|
|
@@ -1296,7 +1332,7 @@ export type ModuleOptions = {
|
|
|
1296
1332
|
/** Keep module mechanism of the matched modules as-is, such as module.exports, require, import. */
|
|
1297
1333
|
noParse?: NoParseOption;
|
|
1298
1334
|
};
|
|
1299
|
-
type AllowTarget = 'web' | 'webworker' | 'es3' | 'es5' | 'es2015' | 'es2016' | 'es2017' | 'es2018' | 'es2019' | 'es2020' | 'es2021' | 'es2022' | 'es2023' | 'es2024' | 'es2025' | 'node' | 'async-node' | `node${number}` | `async-node${number}` | `node${number}.${number}` | `async-node${number}.${number}` | 'electron-main' | `electron${number}-main` | `electron${number}.${number}-main` | 'electron-renderer' | `electron${number}-renderer` | `electron${number}.${number}-renderer` | 'electron-preload' | `electron${number}-preload` | `electron${number}.${number}-preload` | 'nwjs' | `nwjs${number}` | `nwjs${number}.${number}` | 'node-webkit' | `node-webkit${number}` | `node-webkit${number}.${number}` | 'browserslist' | `browserslist:${string}`;
|
|
1335
|
+
type AllowTarget = 'web' | 'webworker' | 'es3' | 'es5' | 'es2015' | 'es2016' | 'es2017' | 'es2018' | 'es2019' | 'es2020' | 'es2021' | 'es2022' | 'es2023' | 'es2024' | 'es2025' | 'es2026' | 'node' | 'async-node' | `node${number}` | `async-node${number}` | `node${number}.${number}` | `async-node${number}.${number}` | 'electron-main' | `electron${number}-main` | `electron${number}.${number}-main` | 'electron-renderer' | `electron${number}-renderer` | `electron${number}.${number}-renderer` | 'electron-preload' | `electron${number}-preload` | `electron${number}.${number}-preload` | 'nwjs' | `nwjs${number}` | `nwjs${number}.${number}` | 'node-webkit' | `node-webkit${number}` | `node-webkit${number}.${number}` | 'browserslist' | `browserslist:${string}`;
|
|
1300
1336
|
/** Used to configure the target environment of Rspack output and the ECMAScript version of Rspack runtime code. */
|
|
1301
1337
|
export type Target = false | AllowTarget | AllowTarget[];
|
|
1302
1338
|
/**
|
|
@@ -1332,6 +1368,10 @@ export type ExternalItemValue = string | boolean | string[] | ExternalItemUmdVal
|
|
|
1332
1368
|
export type ExternalItemObjectUnknown = {
|
|
1333
1369
|
[x: string]: ExternalItemValue;
|
|
1334
1370
|
};
|
|
1371
|
+
export type ExternalItemObjectKnown = {
|
|
1372
|
+
/** Specify externals depending on the importing module's layer. */
|
|
1373
|
+
byLayer?: Record<string, ExternalItem> | ((layer: string | null) => ExternalItem | undefined);
|
|
1374
|
+
};
|
|
1335
1375
|
/**
|
|
1336
1376
|
* Data object passed as argument when a function is set for 'externals'.
|
|
1337
1377
|
*/
|
|
@@ -1362,7 +1402,7 @@ export type ExternalItemFunctionData = {
|
|
|
1362
1402
|
* }
|
|
1363
1403
|
* ```
|
|
1364
1404
|
* */
|
|
1365
|
-
export type ExternalItem = string | RegExp | ExternalItemObjectUnknown | ((data: ExternalItemFunctionData, callback: (err?: Error | null, result?: ExternalItemValue, type?: ExternalsType) => void) => ExternalItemValue | void | Promise<ExternalItemValue | void>);
|
|
1405
|
+
export type ExternalItem = string | RegExp | ExternalItemObjectKnown | ExternalItemObjectUnknown | ((data: ExternalItemFunctionData, callback: (err?: Error | null, result?: ExternalItemValue, type?: ExternalsType) => void) => ExternalItemValue | void | Promise<ExternalItemValue | void>);
|
|
1366
1406
|
/**
|
|
1367
1407
|
* Prevent bundling of certain imported packages and instead retrieve these external dependencies at runtime.
|
|
1368
1408
|
*
|
|
@@ -1611,34 +1651,6 @@ export type MemoryCacheOptions = {
|
|
|
1611
1651
|
*/
|
|
1612
1652
|
type: 'memory';
|
|
1613
1653
|
};
|
|
1614
|
-
/** Filesystem cache options. Requires `experiments.newCache` to be enabled. */
|
|
1615
|
-
export type FileSystemCacheOptions = {
|
|
1616
|
-
type: 'filesystem';
|
|
1617
|
-
/** Name for the cache. Different names create coexisting caches. */
|
|
1618
|
-
name?: string;
|
|
1619
|
-
/** Build dependencies grouped by category. Changes invalidate the cache. */
|
|
1620
|
-
buildDependencies?: Record<string, string[]>;
|
|
1621
|
-
/** Base directory for the cache. Defaults to `node_modules/.cache/rspack`. */
|
|
1622
|
-
cacheDirectory?: string;
|
|
1623
|
-
/** Cache location. Defaults to `<cacheDirectory>/<name>`. */
|
|
1624
|
-
cacheLocation?: string;
|
|
1625
|
-
/** Cache version. Changing this value invalidates the cache. Defaults to `""`. */
|
|
1626
|
-
version?: string;
|
|
1627
|
-
/** Read existing cache data without writing to disk. Defaults to `false`. */
|
|
1628
|
-
readonly?: boolean;
|
|
1629
|
-
/**
|
|
1630
|
-
* Generations to retain unused entries in memory. Use 0 to disable the memory
|
|
1631
|
-
* cache or Infinity to retain entries forever. Defaults to 5 in development,
|
|
1632
|
-
* Infinity otherwise.
|
|
1633
|
-
*/
|
|
1634
|
-
maxMemoryGenerations?: number;
|
|
1635
|
-
/** Idle time before writing to disk, in milliseconds. Defaults to 60000. */
|
|
1636
|
-
idleTimeout?: number;
|
|
1637
|
-
/** Idle time before the initial write, in milliseconds. Defaults to 5000. */
|
|
1638
|
-
idleTimeoutForInitialStore?: number;
|
|
1639
|
-
/** Idle time after large changes, in milliseconds. Defaults to 1000. */
|
|
1640
|
-
idleTimeoutAfterLargeChanges?: number;
|
|
1641
|
-
};
|
|
1642
1654
|
/**
|
|
1643
1655
|
* Options for caching snapshots and intermediate products during the build process.
|
|
1644
1656
|
* @description Controls whether caching is enabled or disabled.
|
|
@@ -1650,7 +1662,7 @@ export type FileSystemCacheOptions = {
|
|
|
1650
1662
|
* // Disable caching
|
|
1651
1663
|
* cache: false
|
|
1652
1664
|
*/
|
|
1653
|
-
export type CacheOptions = boolean | MemoryCacheOptions | PersistentCacheOptions
|
|
1665
|
+
export type CacheOptions = boolean | MemoryCacheOptions | PersistentCacheOptions;
|
|
1654
1666
|
export type StatsPresets = 'normal' | 'none' | 'verbose' | 'errors-only' | 'errors-warnings' | 'minimal' | 'detailed' | 'summary';
|
|
1655
1667
|
type AssetFilterItemTypes = RegExp | string | ((name: string, asset: any) => boolean);
|
|
1656
1668
|
type AssetFilterTypes = boolean | AssetFilterItemTypes | AssetFilterItemTypes[];
|
|
@@ -1697,6 +1709,10 @@ export type StatsOptions = {
|
|
|
1697
1709
|
* @default true
|
|
1698
1710
|
*/
|
|
1699
1711
|
assets?: boolean;
|
|
1712
|
+
/**
|
|
1713
|
+
* Includes cache hit, miss, reuse, and store counts by cache name.
|
|
1714
|
+
*/
|
|
1715
|
+
cacheInfo?: boolean;
|
|
1700
1716
|
/**
|
|
1701
1717
|
* Enables or disables the display of chunk stats.
|
|
1702
1718
|
* @default true
|
|
@@ -2118,6 +2134,11 @@ type SharedOptimizationSplitChunksCacheGroup = {
|
|
|
2118
2134
|
*/
|
|
2119
2135
|
minSize?: OptimizationSplitChunksSizes;
|
|
2120
2136
|
minSizeReduction?: OptimizationSplitChunksSizes;
|
|
2137
|
+
/**
|
|
2138
|
+
* Minimum size of the chunk remaining after splitting from a single chunk.
|
|
2139
|
+
* Defaults to 0 in development mode and minSize otherwise.
|
|
2140
|
+
*/
|
|
2141
|
+
minRemainingSize?: OptimizationSplitChunksSizes;
|
|
2121
2142
|
/**
|
|
2122
2143
|
* Size threshold at which splitting is enforced and other restrictions
|
|
2123
2144
|
* (minRemainingSize, maxAsyncRequests, maxInitialRequests) are ignored.
|
|
@@ -2222,8 +2243,9 @@ export type Optimization = {
|
|
|
2222
2243
|
moduleIds?: false | 'named' | 'natural' | 'deterministic' | 'compact-hashed' | CompatHashedIds | 'hashed';
|
|
2223
2244
|
/**
|
|
2224
2245
|
* Which algorithm to use when choosing chunk ids.
|
|
2225
|
-
* Setting to `false` disables
|
|
2226
|
-
*
|
|
2246
|
+
* Setting this to `false` disables automatic chunk ID assignment. Add a chunk ID
|
|
2247
|
+
* plugin from `rspack.ids`, such as `new rspack.ids.CompactHashedChunkIdsPlugin()`,
|
|
2248
|
+
* to `plugins`. Custom JavaScript plugins cannot currently assign chunk IDs.
|
|
2227
2249
|
*/
|
|
2228
2250
|
chunkIds?: false | 'natural' | 'named' | 'deterministic' | 'compact-hashed' | CompatHashedIds | 'size' | 'total-size';
|
|
2229
2251
|
/**
|
|
@@ -2475,7 +2497,7 @@ export type NewCache = {
|
|
|
2475
2497
|
loader?: boolean;
|
|
2476
2498
|
/** Enable the asset minimization cache. @default true */
|
|
2477
2499
|
minimize?: boolean;
|
|
2478
|
-
/** Enable the module and loader resolution cache. @default
|
|
2500
|
+
/** Enable the module and loader resolution cache. @default false */
|
|
2479
2501
|
resolver?: boolean;
|
|
2480
2502
|
};
|
|
2481
2503
|
export type NewCachePresets = boolean;
|
|
@@ -2576,7 +2598,7 @@ export type WatchOptions = {
|
|
|
2576
2598
|
* A function receives each entry and must return `true` to ignore it; unlike
|
|
2577
2599
|
* the other forms, its path keeps the platform separators.
|
|
2578
2600
|
*/
|
|
2579
|
-
ignored?: string | RegExp | string[] | ((entry: string) => boolean);
|
|
2601
|
+
ignored?: string | RegExp | (string | RegExp)[] | ((entry: string) => boolean);
|
|
2580
2602
|
/**
|
|
2581
2603
|
* Turn on polling by passing true, or specifying a poll interval in milliseconds.
|
|
2582
2604
|
* @default false
|
package/dist/cssExtractHmr.js
CHANGED
|
@@ -15,7 +15,7 @@ function normalizeUrl(url) {
|
|
|
15
15
|
return accumulator;
|
|
16
16
|
}, []).join('/');
|
|
17
17
|
}
|
|
18
|
-
let srcByModuleId = Object.create(null), noDocument = "u" < typeof document, { forEach
|
|
18
|
+
let srcByModuleId = Object.create(null), noDocument = "u" < typeof document, { forEach } = Array.prototype;
|
|
19
19
|
function noop() {}
|
|
20
20
|
function updateCss(el, url) {
|
|
21
21
|
let normalizedUrl;
|
package/dist/exports.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export type { NormalModuleFactory } from './NormalModuleFactory.js';
|
|
|
23
23
|
export { type RspackError, type RspackSeverity, ValidationError, } from './RspackError.js';
|
|
24
24
|
export { RuntimeGlobals } from './RuntimeGlobals.js';
|
|
25
25
|
export { RuntimeModule } from './RuntimeModule.js';
|
|
26
|
-
export type { StatsAsset, StatsChunk, StatsCompilation, StatsError, StatsModule, } from './Stats.js';
|
|
26
|
+
export type { StatsAsset, StatsCacheInfo, StatsChunk, StatsCompilation, StatsError, StatsModule, } from './Stats.js';
|
|
27
27
|
export { Stats } from './Stats.js';
|
|
28
28
|
export { StatsErrorCode } from './stats/statsFactoryUtils.js';
|
|
29
29
|
export { RspackOptionsApply, RspackOptionsApply as WebpackOptionsApply };
|
|
@@ -34,7 +34,7 @@ export type { ConcatenationArg } from './RuntimeTemplate.js';
|
|
|
34
34
|
export { ModuleFilenameHelpers };
|
|
35
35
|
export declare const WebpackError: ErrorConstructor;
|
|
36
36
|
export type { Watching } from './Watching.js';
|
|
37
|
-
import * as sources from '
|
|
37
|
+
import * as sources from './sources.js';
|
|
38
38
|
export { sources };
|
|
39
39
|
import { applyRspackOptionsDefaults, getNormalizedRspackOptions } from './config/index.js';
|
|
40
40
|
type Config = {
|
|
@@ -154,7 +154,7 @@ export declare const sharing: {
|
|
|
154
154
|
};
|
|
155
155
|
export type { FeatureOptions as LightningcssFeatureOptions, LoaderOptions as LightningcssLoaderOptions, } from './builtin-loader/lightningcss/index.js';
|
|
156
156
|
export type { SwcLoaderEnvConfig, SwcLoaderEsParserConfig, SwcLoaderJscConfig, SwcLoaderModuleConfig, SwcLoaderOptions, SwcLoaderParserConfig, SwcLoaderTransformConfig, SwcLoaderTsParserConfig, } from './builtin-loader/swc/index.js';
|
|
157
|
-
export type { CircularCheckRspackPluginOptions, CircularDependencyRspackPluginOptions, CopyRspackPluginOptions, CssExtractRspackLoaderOptions, CssExtractRspackPluginOptions, EvalDevToolModulePluginOptions, HtmlRspackPluginOptions, LightningCssMinimizerRspackPluginOptions, RsdoctorPluginData, RsdoctorPluginHooks, SourceMapDevToolPluginOptions, SubresourceIntegrityPluginOptions, SwcJsMinimizerRspackPluginOptions, } from './builtin-plugin/index.js';
|
|
157
|
+
export type { CircularCheckRspackPluginOptions, CircularDependencyRspackPluginOptions, CopyRspackPluginOptions, CssExtractRspackLoaderOptions, CssExtractRspackPluginOptions, EvalDevToolModulePluginOptions, EvalSourceMapDevToolPluginOptions, HtmlRspackPluginOptions, LightningCssMinimizerRspackPluginOptions, RsdoctorPluginData, RsdoctorPluginHooks, SourceMapDevToolPluginOptions, SubresourceIntegrityPluginOptions, SwcJsMinimizerRspackPluginOptions, } from './builtin-plugin/index.js';
|
|
158
158
|
export { CircularCheckRspackPlugin, CircularDependencyRspackPlugin, ContextReplacementPlugin, CopyRspackPlugin, CssExtractRspackPlugin, EvalDevToolModulePlugin, EvalSourceMapDevToolPlugin, HtmlRspackPlugin, LightningCssMinimizerRspackPlugin, NormalModuleReplacementPlugin, SourceMapDevToolPlugin, SwcJsMinimizerRspackPlugin, } from './builtin-plugin/index.js';
|
|
159
159
|
import { EnforceExtension, ResolverFactory, async as resolveAsync, sync as resolveSync } from '@rspack/binding';
|
|
160
160
|
import { createNativePlugin } from './builtin-plugin/index.js';
|