@rspack/core 2.0.0-canary-20260116 → 2.0.0-canary.20260120
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/Compiler.d.ts +3 -1
- package/dist/RuntimeGlobals.d.ts +1 -1
- package/dist/builtin-loader/lightningcss/index.d.ts +11 -9
- package/dist/builtin-loader/lightningcss/target.d.ts +4 -0
- package/dist/builtin-loader/swc/index.d.ts +2 -2
- package/dist/builtin-plugin/EsmLibraryPlugin.d.ts +2 -0
- package/dist/builtin-plugin/LightningCssMinimizerRspackPlugin.d.ts +5 -4
- package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +3 -2
- package/dist/config/adapterRuleUse.d.ts +2 -1
- package/dist/config/defaults.d.ts +4 -2
- package/dist/config/target.d.ts +14 -11
- package/dist/config/types.d.ts +13 -1
- package/dist/cssExtractLoader.js +3 -3
- package/dist/index.js +452 -143
- package/dist/util/targetsVersion.d.ts +2 -0
- package/hot/lazy-compilation-node.js +91 -34
- package/hot/lazy-compilation-web.js +61 -35
- package/package.json +8 -7
- package/compiled/browserslist-load-config/index.d.ts +0 -21
- package/compiled/browserslist-load-config/index.js +0 -252
- package/compiled/browserslist-load-config/license +0 -21
- package/compiled/browserslist-load-config/package.json +0 -1
- package/dist/builtin-loader/index.d.ts +0 -1
package/dist/Compiler.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ import type { CompilationParams } from './Compilation.js';
|
|
|
16
16
|
import { Compilation } from './Compilation.js';
|
|
17
17
|
import { ContextModuleFactory } from './ContextModuleFactory.js';
|
|
18
18
|
import type { EntryNormalized, OutputNormalized, RspackOptionsNormalized, RspackPluginInstance } from './config/index.js';
|
|
19
|
-
import type { PlatformTargetProperties } from './config/target.js';
|
|
19
|
+
import type { ExtractedTargetProperties, PlatformTargetProperties } from './config/target.js';
|
|
20
20
|
import type { FileSystemInfoEntry } from './FileSystemInfo.js';
|
|
21
21
|
import type { rspack } from './index.js';
|
|
22
22
|
import Cache from './lib/Cache.js';
|
|
@@ -129,6 +129,8 @@ declare class Compiler {
|
|
|
129
129
|
get _lastCompilation(): Compilation | undefined;
|
|
130
130
|
get platform(): PlatformTargetProperties;
|
|
131
131
|
set platform(platform: PlatformTargetProperties);
|
|
132
|
+
get target(): ExtractedTargetProperties;
|
|
133
|
+
set target(target: ExtractedTargetProperties);
|
|
132
134
|
/**
|
|
133
135
|
* Note: This is not a webpack public API, maybe removed in future.
|
|
134
136
|
* @internal
|
package/dist/RuntimeGlobals.d.ts
CHANGED
|
@@ -352,5 +352,5 @@ export declare enum RuntimeVariable {
|
|
|
352
352
|
}
|
|
353
353
|
export declare function renderRuntimeVariables(variable: RuntimeVariable, _compilerOptions?: RspackOptionsNormalized): string;
|
|
354
354
|
export declare function createCompilerRuntimeGlobals(compilerOptions?: RspackOptionsNormalized): Record<keyof typeof RuntimeGlobals, string>;
|
|
355
|
-
declare const DefaultRuntimeGlobals: Record<"publicPath" | "chunkName" | "moduleId" | "module" | "
|
|
355
|
+
declare const DefaultRuntimeGlobals: Record<"publicPath" | "chunkName" | "moduleId" | "module" | "require" | "global" | "system" | "exports" | "requireScope" | "thisAsExports" | "returnExportsFromRuntime" | "moduleLoaded" | "entryModuleId" | "moduleCache" | "moduleFactories" | "moduleFactoriesAddOnly" | "ensureChunk" | "ensureChunkHandlers" | "ensureChunkIncludeEntries" | "prefetchChunk" | "prefetchChunkHandlers" | "preloadChunk" | "preloadChunkHandlers" | "definePropertyGetters" | "makeNamespaceObject" | "createFakeNamespaceObject" | "compatGetDefaultExport" | "harmonyModuleDecorator" | "nodeModuleDecorator" | "getFullHash" | "wasmInstances" | "instantiateWasm" | "uncaughtErrorHandler" | "scriptNonce" | "loadScript" | "createScript" | "createScriptUrl" | "getTrustedTypesPolicy" | "hasFetchPriority" | "runtimeId" | "getChunkScriptFilename" | "getChunkCssFilename" | "rspackVersion" | "hasCssModules" | "rspackUniqueId" | "getChunkUpdateScriptFilename" | "getChunkUpdateCssFilename" | "startup" | "startupNoDefault" | "startupOnlyAfter" | "startupOnlyBefore" | "chunkCallback" | "startupEntrypoint" | "startupChunkDependencies" | "onChunksLoaded" | "externalInstallChunk" | "interceptModuleExecution" | "shareScopeMap" | "initializeSharing" | "currentRemoteGetScope" | "getUpdateManifestFilename" | "hmrDownloadManifest" | "hmrDownloadUpdateHandlers" | "hmrModuleData" | "hmrInvalidateModuleHandlers" | "hmrRuntimeStatePrefix" | "amdDefine" | "amdOptions" | "hasOwnProperty" | "systemContext" | "baseURI" | "relativeUrl" | "asyncModule" | "asyncModuleExportSymbol" | "makeDeferredNamespaceObject" | "makeDeferredNamespaceObjectSymbol", string>;
|
|
356
356
|
export { DefaultRuntimeGlobals as RuntimeGlobals };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { GetLoaderOptions } from '../../config/adapterRuleUse.js';
|
|
1
2
|
/**
|
|
2
3
|
MIT License
|
|
3
4
|
|
|
@@ -49,15 +50,15 @@ export declare enum Features {
|
|
|
49
50
|
Color = 64512
|
|
50
51
|
}
|
|
51
52
|
export interface Targets {
|
|
52
|
-
android?:
|
|
53
|
-
chrome?:
|
|
54
|
-
edge?:
|
|
55
|
-
firefox?:
|
|
56
|
-
ie?:
|
|
57
|
-
ios_saf?:
|
|
58
|
-
opera?:
|
|
59
|
-
safari?:
|
|
60
|
-
samsung?:
|
|
53
|
+
android?: string;
|
|
54
|
+
chrome?: string;
|
|
55
|
+
edge?: string;
|
|
56
|
+
firefox?: string;
|
|
57
|
+
ie?: string;
|
|
58
|
+
ios_saf?: string;
|
|
59
|
+
opera?: string;
|
|
60
|
+
safari?: string;
|
|
61
|
+
samsung?: string;
|
|
61
62
|
}
|
|
62
63
|
export interface Drafts {
|
|
63
64
|
/** Whether to enable @custom-media rules. */
|
|
@@ -110,3 +111,4 @@ export type LoaderOptions = {
|
|
|
110
111
|
pseudoClasses?: PseudoClasses;
|
|
111
112
|
unusedSymbols?: string[];
|
|
112
113
|
};
|
|
114
|
+
export declare const getLightningcssLoaderOptions: GetLoaderOptions;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type binding from '@rspack/binding';
|
|
2
|
+
import type { Targets } from './index.js';
|
|
3
|
+
export declare function encodeTargets(targets: Targets): binding.RawLightningCssBrowsers;
|
|
4
|
+
export declare function defaultTargetsFromRspackTargets(targets: Record<string, string>): binding.RawLightningCssBrowsers;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { GetLoaderOptions } from '../../config/adapterRuleUse.js';
|
|
1
2
|
export type { CollectTypeScriptInfoOptions } from './collectTypeScriptInfo.js';
|
|
2
|
-
export { resolveCollectTypeScriptInfo } from './collectTypeScriptInfo.js';
|
|
3
3
|
export type { PluginImportOptions } from './pluginImport.js';
|
|
4
|
-
export { resolvePluginImport } from './pluginImport.js';
|
|
5
4
|
export type { SwcLoaderEnvConfig, SwcLoaderEsParserConfig, SwcLoaderJscConfig, SwcLoaderModuleConfig, SwcLoaderOptions, SwcLoaderParserConfig, SwcLoaderTransformConfig, SwcLoaderTsParserConfig, } from './types.js';
|
|
5
|
+
export declare const getSwcLoaderOptions: GetLoaderOptions;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { Compiler } from '../Compiler.js';
|
|
2
|
+
import type { RspackOptionsNormalized } from '../config/index.js';
|
|
3
|
+
export declare function applyLimits(options: RspackOptionsNormalized): void;
|
|
2
4
|
export declare class EsmLibraryPlugin {
|
|
3
5
|
static PLUGIN_NAME: string;
|
|
4
6
|
options?: {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type Drafts, type FeatureOptions, type NonStandard, type PseudoClasses } from '../builtin-loader/lightningcss/index.js';
|
|
1
|
+
import { type Drafts, type FeatureOptions, type NonStandard, type PseudoClasses, type Targets } from '../builtin-loader/lightningcss/index.js';
|
|
2
|
+
import type { Compiler } from '../Compiler.js';
|
|
2
3
|
import type { AssetConditions } from '../util/assetCondition.js';
|
|
3
4
|
export type LightningCssMinimizerRspackPluginOptions = {
|
|
4
5
|
test?: AssetConditions;
|
|
@@ -7,7 +8,7 @@ export type LightningCssMinimizerRspackPluginOptions = {
|
|
|
7
8
|
removeUnusedLocalIdents?: boolean;
|
|
8
9
|
minimizerOptions?: {
|
|
9
10
|
errorRecovery?: boolean;
|
|
10
|
-
targets?: string[] | string;
|
|
11
|
+
targets?: string[] | string | Targets;
|
|
11
12
|
include?: FeatureOptions;
|
|
12
13
|
exclude?: FeatureOptions;
|
|
13
14
|
drafts?: Drafts;
|
|
@@ -21,7 +22,7 @@ export declare const LightningCssMinimizerRspackPlugin: {
|
|
|
21
22
|
name: string;
|
|
22
23
|
_args: [options?: LightningCssMinimizerRspackPluginOptions | undefined];
|
|
23
24
|
affectedHooks: keyof import("../index.js").CompilerHooks | undefined;
|
|
24
|
-
raw(compiler:
|
|
25
|
-
apply(compiler:
|
|
25
|
+
raw(compiler: Compiler): import("@rspack/binding").BuiltinPlugin;
|
|
26
|
+
apply(compiler: Compiler): void;
|
|
26
27
|
};
|
|
27
28
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Compiler } from '../Compiler.js';
|
|
1
2
|
import type { LiteralUnion } from '../config/index.js';
|
|
2
3
|
import type { AssetConditions } from '../util/assetCondition.js';
|
|
3
4
|
type ExtractCommentsCondition = boolean | RegExp;
|
|
@@ -208,8 +209,8 @@ export declare const SwcJsMinimizerRspackPlugin: {
|
|
|
208
209
|
name: string;
|
|
209
210
|
_args: [options?: SwcJsMinimizerRspackPluginOptions | undefined];
|
|
210
211
|
affectedHooks: keyof import("../index.js").CompilerHooks | undefined;
|
|
211
|
-
raw(compiler:
|
|
212
|
-
apply(compiler:
|
|
212
|
+
raw(compiler: Compiler): import("@rspack/binding").BuiltinPlugin;
|
|
213
|
+
apply(compiler: Compiler): void;
|
|
213
214
|
};
|
|
214
215
|
};
|
|
215
216
|
export {};
|
|
@@ -7,7 +7,7 @@ import type { Module } from '../Module.js';
|
|
|
7
7
|
import type { ResolveRequest } from '../Resolver.js';
|
|
8
8
|
import type Hash from '../util/hash/index.js';
|
|
9
9
|
import type { RspackOptionsNormalized } from './normalization.js';
|
|
10
|
-
import type { Mode, PublicPath, Resolve, RuleSetUseItem, Target } from './types.js';
|
|
10
|
+
import type { Mode, PublicPath, Resolve, RuleSetLoaderWithOptions, RuleSetUseItem, Target } from './types.js';
|
|
11
11
|
export declare const BUILTIN_LOADER_PREFIX = "builtin:";
|
|
12
12
|
export interface ComposeJsUseOptions {
|
|
13
13
|
context: RawOptions['context'];
|
|
@@ -387,5 +387,6 @@ export type LoaderDefinition<OptionsType = {}, ContextAdditions = {}> = LoaderDe
|
|
|
387
387
|
pitch?: PitchLoaderDefinitionFunction;
|
|
388
388
|
};
|
|
389
389
|
export declare function createRawModuleRuleUses(uses: RuleSetUseItem | RuleSetUseItem[], path: string, options: ComposeJsUseOptions): RawModuleRuleUse[];
|
|
390
|
+
export type GetLoaderOptions = (o: RuleSetLoaderWithOptions['options'], options: ComposeJsUseOptions) => RuleSetLoaderWithOptions['options'];
|
|
390
391
|
export declare function isUseSourceMap(devtool: RspackOptionsNormalized['devtool']): boolean;
|
|
391
392
|
export declare function isUseSimpleSourceMap(devtool: RspackOptionsNormalized['devtool']): boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { RspackOptionsNormalized } from './normalization.js';
|
|
2
|
-
export declare const applyRspackOptionsDefaults: (options: RspackOptionsNormalized) => {
|
|
3
|
-
platform:
|
|
2
|
+
export declare const applyRspackOptionsDefaults: (options: RspackOptionsNormalized) => false | {
|
|
3
|
+
platform: {
|
|
4
4
|
web: boolean | null | undefined;
|
|
5
5
|
browser: boolean | null | undefined;
|
|
6
6
|
webworker: boolean | null | undefined;
|
|
@@ -8,6 +8,8 @@ export declare const applyRspackOptionsDefaults: (options: RspackOptionsNormaliz
|
|
|
8
8
|
nwjs: boolean | null | undefined;
|
|
9
9
|
electron: boolean | null | undefined;
|
|
10
10
|
};
|
|
11
|
+
esVersion: number | null | undefined;
|
|
12
|
+
targets: Record<string, string> | null | undefined;
|
|
11
13
|
};
|
|
12
14
|
export declare const applyRspackOptionsBaseDefaults: (options: RspackOptionsNormalized) => void;
|
|
13
15
|
export declare const getPnpDefault: () => boolean;
|
package/dist/config/target.d.ts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The following code is modified based on
|
|
3
|
+
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/config/target.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
|
+
*/
|
|
1
10
|
/**
|
|
2
11
|
* @param context the context directory
|
|
3
12
|
* @returns default target
|
|
@@ -73,21 +82,15 @@ export type EcmaTargetProperties = {
|
|
|
73
82
|
/** async functions and await are available */
|
|
74
83
|
asyncFunction: boolean | null;
|
|
75
84
|
};
|
|
85
|
+
export type ExtractedTargetProperties = {
|
|
86
|
+
esVersion?: number | null;
|
|
87
|
+
targets?: Record<string, string> | null;
|
|
88
|
+
};
|
|
76
89
|
type Never<T> = {
|
|
77
90
|
[P in keyof T]?: never;
|
|
78
91
|
};
|
|
79
92
|
type Mix<A, B> = (A & Never<B>) | (Never<A> & B) | (A & B);
|
|
80
|
-
export type TargetProperties = Mix<Mix<PlatformTargetProperties, ElectronContextTargetProperties>, Mix<ApiTargetProperties, EcmaTargetProperties
|
|
81
|
-
/**
|
|
82
|
-
* @param target the target
|
|
83
|
-
* @param context the context directory
|
|
84
|
-
* @returns target properties
|
|
85
|
-
*/
|
|
93
|
+
export type TargetProperties = Mix<Mix<PlatformTargetProperties, ElectronContextTargetProperties>, Mix<ApiTargetProperties, EcmaTargetProperties>> & ExtractedTargetProperties;
|
|
86
94
|
export declare const getTargetProperties: (target: string, context: string) => TargetProperties;
|
|
87
|
-
/**
|
|
88
|
-
* @param targets the targets
|
|
89
|
-
* @param context the context directory
|
|
90
|
-
* @returns target properties
|
|
91
|
-
*/
|
|
92
95
|
export declare const getTargetsProperties: (targets: string[], context: string) => TargetProperties;
|
|
93
96
|
export {};
|
package/dist/config/types.d.ts
CHANGED
|
@@ -83,6 +83,10 @@ export type LibraryOptions = {
|
|
|
83
83
|
* Otherwise, an anonymous define is used.
|
|
84
84
|
* */
|
|
85
85
|
umdNamedDefine?: UmdNamedDefine;
|
|
86
|
+
/**
|
|
87
|
+
* PreserveModules only works for `modern-module`
|
|
88
|
+
*/
|
|
89
|
+
preserveModules?: string;
|
|
86
90
|
};
|
|
87
91
|
/** Options for library. */
|
|
88
92
|
export type Library = LibraryName | LibraryOptions | undefined;
|
|
@@ -339,7 +343,7 @@ export type Output = {
|
|
|
339
343
|
hotUpdateChunkFilename?: HotUpdateChunkFilename;
|
|
340
344
|
/**
|
|
341
345
|
* Only used when target is set to 'web', which uses JSONP for loading hot updates.
|
|
342
|
-
* @default '
|
|
346
|
+
* @default 'rspackHotUpdate' + output.uniqueName
|
|
343
347
|
* */
|
|
344
348
|
hotUpdateGlobal?: HotUpdateGlobal;
|
|
345
349
|
/**
|
|
@@ -2083,6 +2087,14 @@ export type Experiments = {
|
|
|
2083
2087
|
* - `module.generator["css/auto"]`
|
|
2084
2088
|
* - `module.generator.css`
|
|
2085
2089
|
* - `module.generator["css/module"]`
|
|
2090
|
+
*
|
|
2091
|
+
* @deprecated This option is deprecated. In Rspack 2.0, users need to manually add CSS rules to enable CSS support.
|
|
2092
|
+
* Example:
|
|
2093
|
+
* ```js
|
|
2094
|
+
* module: {
|
|
2095
|
+
* rules: [{ test: /\.css$/, type: "css/auto" }]
|
|
2096
|
+
* }
|
|
2097
|
+
* ```
|
|
2086
2098
|
*/
|
|
2087
2099
|
css?: boolean;
|
|
2088
2100
|
/**
|
package/dist/cssExtractLoader.js
CHANGED
|
@@ -43,8 +43,8 @@ function hotLoader(content, context) {
|
|
|
43
43
|
}
|
|
44
44
|
let pitch = function(request, _, data) {
|
|
45
45
|
let publicPathForExtract;
|
|
46
|
-
if (this.
|
|
47
|
-
let e = Error("use type 'css' and `CssExtractRspackPlugin` together, please set `
|
|
46
|
+
if (this._module && ('css' === this._module.type || 'css/auto' === this._module.type || 'css/global' === this._module.type || 'css/module' === this._module.type)) {
|
|
47
|
+
let e = Error("use type 'css' and `CssExtractRspackPlugin` together, please set `{ type: \"javascript/auto\" }` for rules with `CssExtractRspackPlugin` in your rspack config (now `CssExtractRspackPlugin` does nothing).");
|
|
48
48
|
e.stack = void 0, this.emitWarning(e);
|
|
49
49
|
return;
|
|
50
50
|
}
|
|
@@ -113,6 +113,6 @@ let pitch = function(request, _, data) {
|
|
|
113
113
|
});
|
|
114
114
|
};
|
|
115
115
|
export default function(content) {
|
|
116
|
-
if (this.
|
|
116
|
+
if (this._module && ('css' === this._module.type || 'css/auto' === this._module.type || 'css/global' === this._module.type || 'css/module' === this._module.type)) return content;
|
|
117
117
|
};
|
|
118
118
|
export { ABSOLUTE_PUBLIC_PATH, AUTO_PUBLIC_PATH, BASE_URI, MODULE_TYPE, SINGLE_DOT_PATH_SEGMENT, hotLoader, pitch };
|