@rspack/browser 2.0.0-beta.4 → 2.0.0-beta.5
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/config/types.d.ts +7 -4
- package/dist/index.js +32 -21
- package/dist/napi-binding.d.ts +22 -2
- package/dist/rspack.wasm32-wasi.wasm +0 -0
- package/dist/util/supportsColor.d.ts +6 -0
- package/package.json +1 -1
package/dist/config/types.d.ts
CHANGED
|
@@ -809,10 +809,10 @@ export type JavascriptParserOptions = {
|
|
|
809
809
|
*/
|
|
810
810
|
dynamicImportFetchPriority?: 'low' | 'high' | 'auto';
|
|
811
811
|
/**
|
|
812
|
-
* Enable or disable evaluating import.meta.
|
|
813
|
-
* @default
|
|
812
|
+
* Enable or disable evaluating import.meta. Set to 'preserve-unknown' to preserve unknown properties for runtime evaluation.
|
|
813
|
+
* @default 'preserve-unknown'
|
|
814
814
|
*/
|
|
815
|
-
importMeta?: boolean;
|
|
815
|
+
importMeta?: boolean | 'preserve-unknown';
|
|
816
816
|
/**
|
|
817
817
|
* Enable parsing of new URL() syntax.
|
|
818
818
|
* @default true
|
|
@@ -846,6 +846,8 @@ export type JavascriptParserOptions = {
|
|
|
846
846
|
importExportsPresence?: ExportsPresence;
|
|
847
847
|
/** Warn or error for conflicting re-exports */
|
|
848
848
|
reexportExportsPresence?: ExportsPresence;
|
|
849
|
+
/** Handle the this context correctly according to the spec for namespace objects. */
|
|
850
|
+
strictThisContextOnImports?: boolean;
|
|
849
851
|
/** Provide custom syntax for Worker parsing, commonly used to support Worklet */
|
|
850
852
|
worker?: string[] | boolean;
|
|
851
853
|
/** Override the module to strict or non-strict. */
|
|
@@ -1435,7 +1437,8 @@ export type StatsOptions = {
|
|
|
1435
1437
|
errorsCount?: boolean;
|
|
1436
1438
|
/**
|
|
1437
1439
|
* Enables or disables the use of colors in the output.
|
|
1438
|
-
*
|
|
1440
|
+
* When undefined, defaults to true if the environment supports color (TTY, FORCE_COLOR, or NO_COLOR unset), otherwise false.
|
|
1441
|
+
* @default environment-dependent (see above)
|
|
1439
1442
|
*/
|
|
1440
1443
|
colors?: boolean | StatsColorOptions;
|
|
1441
1444
|
/**
|
package/dist/index.js
CHANGED
|
@@ -53063,6 +53063,13 @@ const _parseResourceWithoutFragment = (str)=>{
|
|
|
53063
53063
|
};
|
|
53064
53064
|
};
|
|
53065
53065
|
const parseResourceWithoutFragment = makeCacheable(_parseResourceWithoutFragment);
|
|
53066
|
+
var supportsColor_process = __webpack_require__("../../node_modules/.pnpm/process@0.11.10/node_modules/process/browser.js");
|
|
53067
|
+
function isStatsColorSupported() {
|
|
53068
|
+
if (void 0 === supportsColor_process) return false;
|
|
53069
|
+
const env = supportsColor_process.env ?? {};
|
|
53070
|
+
const argv = supportsColor_process.argv ?? [];
|
|
53071
|
+
return !('NO_COLOR' in env || argv.includes('--no-color')) && ('FORCE_COLOR' in env || argv.includes('--color') || 'win32' === supportsColor_process.platform || supportsColor_process.stdout?.isTTY && 'dumb' !== env.TERM || 'CI' in env);
|
|
53072
|
+
}
|
|
53066
53073
|
function encodeVersion(version) {
|
|
53067
53074
|
const [major, minor = 0, patch = 0] = version.split('-')[0].split('.').map((v)=>parseInt(v, 10));
|
|
53068
53075
|
if (Number.isNaN(major) || Number.isNaN(minor) || Number.isNaN(patch)) return null;
|
|
@@ -55028,11 +55035,12 @@ function getRawJavascriptParserOptions(parser) {
|
|
|
55028
55035
|
dynamicImportPreload: parser.dynamicImportPreload?.toString(),
|
|
55029
55036
|
dynamicImportPrefetch: parser.dynamicImportPrefetch?.toString(),
|
|
55030
55037
|
dynamicImportFetchPriority: parser.dynamicImportFetchPriority,
|
|
55031
|
-
importMeta: parser.importMeta,
|
|
55038
|
+
importMeta: 'boolean' == typeof parser.importMeta ? String(parser.importMeta) : parser.importMeta,
|
|
55032
55039
|
url: parser.url?.toString(),
|
|
55033
55040
|
exprContextCritical: parser.exprContextCritical,
|
|
55034
55041
|
unknownContextCritical: parser.unknownContextCritical,
|
|
55035
55042
|
wrappedContextCritical: parser.wrappedContextCritical,
|
|
55043
|
+
strictThisContextOnImports: parser.strictThisContextOnImports,
|
|
55036
55044
|
wrappedContextRegExp: parser.wrappedContextRegExp,
|
|
55037
55045
|
exportsPresence: false === parser.exportsPresence ? 'false' : parser.exportsPresence,
|
|
55038
55046
|
importExportsPresence: false === parser.importExportsPresence ? 'false' : parser.importExportsPresence,
|
|
@@ -55182,8 +55190,9 @@ function getRawNode(node) {
|
|
|
55182
55190
|
}
|
|
55183
55191
|
function getRawStats(stats) {
|
|
55184
55192
|
const statsOptions = normalizeStatsPreset(stats);
|
|
55193
|
+
const colors = void 0 === statsOptions.colors ? isStatsColorSupported() : Boolean(statsOptions.colors);
|
|
55185
55194
|
return {
|
|
55186
|
-
colors
|
|
55195
|
+
colors
|
|
55187
55196
|
};
|
|
55188
55197
|
}
|
|
55189
55198
|
class ExternalsPlugin extends RspackBuiltinPlugin {
|
|
@@ -56030,15 +56039,14 @@ class SubresourceIntegrityPlugin extends NativeSubresourceIntegrityPlugin {
|
|
|
56030
56039
|
}
|
|
56031
56040
|
let src = '';
|
|
56032
56041
|
if (isUrlSrc) {
|
|
56033
|
-
|
|
56042
|
+
const isLocalPublicPath = !publicPath || '/' === publicPath || './' === publicPath;
|
|
56043
|
+
if (isLocalPublicPath) return;
|
|
56034
56044
|
const protocolRelativePublicPath = publicPath.replace(HTTP_PROTOCOL_REGEX, '');
|
|
56035
56045
|
const protocolRelativeTagSrc = tagSrc.replace(HTTP_PROTOCOL_REGEX, '');
|
|
56036
56046
|
if (!protocolRelativeTagSrc.startsWith(protocolRelativePublicPath)) return;
|
|
56037
|
-
{
|
|
56038
|
-
|
|
56039
|
-
|
|
56040
|
-
src = (0, path_browserify.relative)(publicPathWithScheme, decodeURIComponent(tagSrcWithScheme));
|
|
56041
|
-
}
|
|
56047
|
+
const tagSrcWithScheme = `http:${protocolRelativeTagSrc}`;
|
|
56048
|
+
const publicPathWithScheme = protocolRelativePublicPath.startsWith('//') ? `http:${protocolRelativePublicPath}` : protocolRelativePublicPath;
|
|
56049
|
+
src = (0, path_browserify.relative)(publicPathWithScheme, decodeURIComponent(tagSrcWithScheme));
|
|
56042
56050
|
} else src = (0, path_browserify.relative)(publicPath, decodeURIComponent(tagSrc));
|
|
56043
56051
|
tag.attributes.integrity = this.getIntegrityChecksumForAsset(src) || computeIntegrity(this.options.hashFuncNames, (0, fs_0.readFileSync)((0, path_browserify.join)(outputPath, src)));
|
|
56044
56052
|
tag.attributes.crossorigin = crossOriginLoading || 'anonymous';
|
|
@@ -57537,7 +57545,8 @@ const applyRspackOptionsDefaults = (options)=>{
|
|
|
57537
57545
|
targetProperties,
|
|
57538
57546
|
mode: options.mode,
|
|
57539
57547
|
uniqueName: options.output.uniqueName,
|
|
57540
|
-
deferImport: options.experiments.deferImport
|
|
57548
|
+
deferImport: options.experiments.deferImport,
|
|
57549
|
+
outputModule: options.output.module
|
|
57541
57550
|
});
|
|
57542
57551
|
applyOutputDefaults(options, {
|
|
57543
57552
|
context: options.context,
|
|
@@ -57623,7 +57632,7 @@ const applyIncrementalDefaults = (options)=>{
|
|
|
57623
57632
|
}
|
|
57624
57633
|
};
|
|
57625
57634
|
const applySnapshotDefaults = (_snapshot, _env)=>{};
|
|
57626
|
-
const applyJavascriptParserOptionsDefaults = (parserOptions, { deferImport })=>{
|
|
57635
|
+
const applyJavascriptParserOptionsDefaults = (parserOptions, { deferImport, outputModule })=>{
|
|
57627
57636
|
D(parserOptions, 'dynamicImportMode', 'lazy');
|
|
57628
57637
|
D(parserOptions, 'dynamicImportPrefetch', false);
|
|
57629
57638
|
D(parserOptions, 'dynamicImportPreload', false);
|
|
@@ -57631,6 +57640,7 @@ const applyJavascriptParserOptionsDefaults = (parserOptions, { deferImport })=>{
|
|
|
57631
57640
|
D(parserOptions, 'exprContextCritical', true);
|
|
57632
57641
|
D(parserOptions, 'unknownContextCritical', true);
|
|
57633
57642
|
D(parserOptions, 'wrappedContextCritical', false);
|
|
57643
|
+
D(parserOptions, 'strictThisContextOnImports', false);
|
|
57634
57644
|
D(parserOptions, 'wrappedContextRegExp', /.*/);
|
|
57635
57645
|
D(parserOptions, 'exportsPresence', 'error');
|
|
57636
57646
|
D(parserOptions, 'requireAsExpression', true);
|
|
@@ -57642,7 +57652,7 @@ const applyJavascriptParserOptionsDefaults = (parserOptions, { deferImport })=>{
|
|
|
57642
57652
|
D(parserOptions, 'worker', [
|
|
57643
57653
|
'...'
|
|
57644
57654
|
]);
|
|
57645
|
-
D(parserOptions, 'importMeta', true);
|
|
57655
|
+
D(parserOptions, 'importMeta', outputModule ? 'preserve-unknown' : true);
|
|
57646
57656
|
D(parserOptions, 'typeReexportsPresence', 'no-tolerant');
|
|
57647
57657
|
D(parserOptions, 'jsx', false);
|
|
57648
57658
|
D(parserOptions, 'deferImport', deferImport);
|
|
@@ -57654,7 +57664,7 @@ const applyCssGeneratorOptionsDefaults = (generatorOptions, { targetProperties }
|
|
|
57654
57664
|
const applyJsonGeneratorOptionsDefaults = (generatorOptions)=>{
|
|
57655
57665
|
D(generatorOptions, 'JSONParse', true);
|
|
57656
57666
|
};
|
|
57657
|
-
const applyModuleDefaults = (module, { asyncWebAssembly, targetProperties, mode, uniqueName, deferImport })=>{
|
|
57667
|
+
const applyModuleDefaults = (module, { asyncWebAssembly, targetProperties, mode, uniqueName, deferImport, outputModule })=>{
|
|
57658
57668
|
assertNotNill(module.parser);
|
|
57659
57669
|
assertNotNill(module.generator);
|
|
57660
57670
|
F(module.parser, "asset", ()=>({}));
|
|
@@ -57664,7 +57674,8 @@ const applyModuleDefaults = (module, { asyncWebAssembly, targetProperties, mode,
|
|
|
57664
57674
|
F(module.parser, "javascript", ()=>({}));
|
|
57665
57675
|
assertNotNill(module.parser.javascript);
|
|
57666
57676
|
applyJavascriptParserOptionsDefaults(module.parser.javascript, {
|
|
57667
|
-
deferImport
|
|
57677
|
+
deferImport,
|
|
57678
|
+
outputModule
|
|
57668
57679
|
});
|
|
57669
57680
|
F(module.parser, "json", ()=>({}));
|
|
57670
57681
|
assertNotNill(module.parser["json"]);
|
|
@@ -58024,7 +58035,7 @@ const applyOutputDefaults = (options, { context, targetProperties: tp, isAffecte
|
|
|
58024
58035
|
});
|
|
58025
58036
|
D(output, 'bundlerInfo', {});
|
|
58026
58037
|
if ('object' == typeof output.bundlerInfo) {
|
|
58027
|
-
D(output.bundlerInfo, 'version', "2.0.0-beta.
|
|
58038
|
+
D(output.bundlerInfo, 'version', "2.0.0-beta.5");
|
|
58028
58039
|
D(output.bundlerInfo, 'bundler', 'rspack');
|
|
58029
58040
|
D(output.bundlerInfo, 'force', !output.library);
|
|
58030
58041
|
}
|
|
@@ -59686,7 +59697,7 @@ class MultiStats {
|
|
|
59686
59697
|
return obj;
|
|
59687
59698
|
});
|
|
59688
59699
|
if (childOptions.version) {
|
|
59689
|
-
obj.rspackVersion = "2.0.0-beta.
|
|
59700
|
+
obj.rspackVersion = "2.0.0-beta.5";
|
|
59690
59701
|
obj.version = "5.75.0";
|
|
59691
59702
|
}
|
|
59692
59703
|
if (childOptions.hash) obj.hash = obj.children.map((j)=>j.hash).join('');
|
|
@@ -61372,7 +61383,7 @@ const SIMPLE_EXTRACTORS = {
|
|
|
61372
61383
|
},
|
|
61373
61384
|
version: (object)=>{
|
|
61374
61385
|
object.version = "5.75.0";
|
|
61375
|
-
object.rspackVersion = "2.0.0-beta.
|
|
61386
|
+
object.rspackVersion = "2.0.0-beta.5";
|
|
61376
61387
|
},
|
|
61377
61388
|
env: (object, _compilation, _context, { _env })=>{
|
|
61378
61389
|
object.env = _env;
|
|
@@ -62015,7 +62026,7 @@ const DEFAULTS = {
|
|
|
62015
62026
|
chunksSort: ()=>false,
|
|
62016
62027
|
assetsSort: ()=>'!size',
|
|
62017
62028
|
outputPath: OFF_FOR_TO_STRING,
|
|
62018
|
-
colors: ()=>
|
|
62029
|
+
colors: ()=>isStatsColorSupported()
|
|
62019
62030
|
};
|
|
62020
62031
|
const normalizeFilter = (item)=>{
|
|
62021
62032
|
if ('string' == typeof item) {
|
|
@@ -65423,7 +65434,7 @@ class CollectSharedEntryPlugin extends RspackBuiltinPlugin {
|
|
|
65423
65434
|
compiler.hooks.thisCompilation.tap('Collect shared entry', (compilation)=>{
|
|
65424
65435
|
compilation.hooks.processAssets.tap({
|
|
65425
65436
|
name: 'CollectSharedEntry',
|
|
65426
|
-
stage: compiler.
|
|
65437
|
+
stage: compiler.rspack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE
|
|
65427
65438
|
}, ()=>{
|
|
65428
65439
|
compilation.getAssets().forEach((asset)=>{
|
|
65429
65440
|
if (asset.name === SHARE_ENTRY_ASSET) this._collectedEntries = JSON.parse(asset.source.source().toString());
|
|
@@ -65582,7 +65593,7 @@ class VirtualEntryPlugin {
|
|
|
65582
65593
|
compiler.hooks.thisCompilation.tap('RemoveVirtualEntryAsset', (compilation)=>{
|
|
65583
65594
|
compilation.hooks.processAssets.tap({
|
|
65584
65595
|
name: 'RemoveVirtualEntryAsset',
|
|
65585
|
-
stage: compiler.
|
|
65596
|
+
stage: compiler.rspack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE
|
|
65586
65597
|
}, ()=>{
|
|
65587
65598
|
try {
|
|
65588
65599
|
const chunk = compilation.namedChunks.get(VIRTUAL_ENTRY_NAME);
|
|
@@ -65666,7 +65677,7 @@ class IndependentSharedPlugin {
|
|
|
65666
65677
|
}
|
|
65667
65678
|
});
|
|
65668
65679
|
});
|
|
65669
|
-
compilation.updateAsset(filename, new compiler.
|
|
65680
|
+
compilation.updateAsset(filename, new compiler.rspack.sources.RawSource(JSON.stringify(statsContent)));
|
|
65670
65681
|
};
|
|
65671
65682
|
injectBuildAssetsIntoStatsOrManifest(statsFileName);
|
|
65672
65683
|
injectBuildAssetsIntoStatsOrManifest(manifestFileName);
|
|
@@ -66166,7 +66177,7 @@ function transformSync(source, options) {
|
|
|
66166
66177
|
const _options = JSON.stringify(options || {});
|
|
66167
66178
|
return external_rspack_wasi_browser_js_["default"].transformSync(source, _options);
|
|
66168
66179
|
}
|
|
66169
|
-
const exports_rspackVersion = "2.0.0-beta.
|
|
66180
|
+
const exports_rspackVersion = "2.0.0-beta.5";
|
|
66170
66181
|
const exports_version = "5.75.0";
|
|
66171
66182
|
const exports_WebpackError = Error;
|
|
66172
66183
|
const exports_config = {
|
package/dist/napi-binding.d.ts
CHANGED
|
@@ -1099,6 +1099,18 @@ export interface JsRsdoctorChunkModules {
|
|
|
1099
1099
|
modules: Array<number>
|
|
1100
1100
|
}
|
|
1101
1101
|
|
|
1102
|
+
export interface JsRsdoctorConnection {
|
|
1103
|
+
ukey: number
|
|
1104
|
+
dependencyId: string
|
|
1105
|
+
module: number
|
|
1106
|
+
originModule?: number
|
|
1107
|
+
resolvedModule: number
|
|
1108
|
+
dependencyType: string
|
|
1109
|
+
userRequest: string
|
|
1110
|
+
loc?: string
|
|
1111
|
+
active: boolean
|
|
1112
|
+
}
|
|
1113
|
+
|
|
1102
1114
|
export interface JsRsdoctorDependency {
|
|
1103
1115
|
ukey: number
|
|
1104
1116
|
kind: string
|
|
@@ -1124,7 +1136,6 @@ export interface JsRsdoctorExportInfo {
|
|
|
1124
1136
|
from?: number
|
|
1125
1137
|
variable?: number
|
|
1126
1138
|
identifier?: JsRsdoctorStatement
|
|
1127
|
-
sideEffects: Array<number>
|
|
1128
1139
|
}
|
|
1129
1140
|
|
|
1130
1141
|
export interface JsRsdoctorJsonModuleSize {
|
|
@@ -1146,6 +1157,7 @@ export interface JsRsdoctorModule {
|
|
|
1146
1157
|
chunks: Array<number>
|
|
1147
1158
|
issuerPath: Array<number>
|
|
1148
1159
|
bailoutReason: Array<string>
|
|
1160
|
+
sideEffectsLocations: Array<JsRsdoctorSideEffectLocation>
|
|
1149
1161
|
}
|
|
1150
1162
|
|
|
1151
1163
|
export interface JsRsdoctorModuleGraph {
|
|
@@ -1195,6 +1207,13 @@ export interface JsRsdoctorSideEffect {
|
|
|
1195
1207
|
variable?: number
|
|
1196
1208
|
}
|
|
1197
1209
|
|
|
1210
|
+
export interface JsRsdoctorSideEffectLocation {
|
|
1211
|
+
location: string
|
|
1212
|
+
nodeType: string
|
|
1213
|
+
module: number
|
|
1214
|
+
request: string
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1198
1217
|
export interface JsRsdoctorSourceMapFeatures {
|
|
1199
1218
|
cheap?: boolean
|
|
1200
1219
|
module?: boolean
|
|
@@ -2382,13 +2401,14 @@ export interface RawJavascriptParserOptions {
|
|
|
2382
2401
|
exprContextCritical?: boolean
|
|
2383
2402
|
unknownContextCritical?: boolean
|
|
2384
2403
|
wrappedContextCritical?: boolean
|
|
2404
|
+
strictThisContextOnImports?: boolean
|
|
2385
2405
|
wrappedContextRegExp?: RegExp
|
|
2386
2406
|
exportsPresence?: string
|
|
2387
2407
|
importExportsPresence?: string
|
|
2388
2408
|
reexportExportsPresence?: string
|
|
2389
2409
|
worker?: Array<string>
|
|
2390
2410
|
overrideStrict?: string
|
|
2391
|
-
importMeta?:
|
|
2411
|
+
importMeta?: string
|
|
2392
2412
|
/**
|
|
2393
2413
|
* This option is experimental in Rspack only and subject to change or be removed anytime.
|
|
2394
2414
|
* @experimental
|
|
Binary file
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether the current environment supports color output (TTY, FORCE_COLOR, NO_COLOR, etc.).
|
|
3
|
+
* Used as the default for stats.colors when not explicitly set.
|
|
4
|
+
* @see https://github.com/web-infra-dev/rspack/issues/9353
|
|
5
|
+
*/
|
|
6
|
+
export declare function isStatsColorSupported(): boolean;
|
package/package.json
CHANGED