@rspack/core 0.6.5-canary-6d6fcd3-20240514084813 → 0.6.5-canary-231c64e-20240515075232
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/Chunk.d.ts +1 -1
- package/dist/Chunk.js +1 -1
- package/dist/ChunkGroup.d.ts +1 -1
- package/dist/ChunkGroup.js +3 -3
- package/dist/Compilation.d.ts +46 -65
- package/dist/Compilation.js +128 -222
- package/dist/Compiler.d.ts +75 -44
- package/dist/Compiler.js +325 -278
- package/dist/ContextModuleFactory.d.ts +7 -3
- package/dist/ContextModuleFactory.js +2 -2
- package/dist/Entrypoint.d.ts +1 -1
- package/dist/Entrypoint.js +1 -1
- package/dist/ExecuteModulePlugin.js +1 -1
- package/dist/Module.d.ts +11 -0
- package/dist/Module.js +2 -2
- package/dist/MultiCompiler.d.ts +10 -25
- package/dist/MultiCompiler.js +3 -3
- package/dist/MultiStats.d.ts +1 -1
- package/dist/NormalModuleFactory.d.ts +1 -1
- package/dist/Stats.d.ts +2 -2
- package/dist/Watching.d.ts +0 -9
- package/dist/Watching.js +12 -2
- package/dist/builtin-loader/swc/index.d.ts +6 -6
- package/dist/builtin-loader/swc/index.js +3 -3
- package/dist/builtin-loader/swc/types.d.ts +2 -2
- package/dist/builtin-plugin/APIPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ArrayPushCallbackChunkFormatPlugin.d.ts +1 -1
- package/dist/builtin-plugin/AssetModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/AsyncWebAssemblyModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/BannerPlugin.d.ts +2 -2
- package/dist/builtin-plugin/BannerPlugin.js +1 -1
- package/dist/builtin-plugin/BundlerInfoRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ChunkPrefetchPreloadPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CommonJsChunkFormatPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CopyRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CssModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/DataUriPlugin.d.ts +1 -1
- package/dist/builtin-plugin/DefinePlugin.d.ts +1 -1
- package/dist/builtin-plugin/DeterministicChunkIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/DeterministicModuleIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/DynamicEntryPlugin.d.ts +1 -1
- package/dist/builtin-plugin/DynamicEntryPlugin.js +1 -1
- package/dist/builtin-plugin/ElectronTargetPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EnableChunkLoadingPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EnableLibraryPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EnableWasmLoadingPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EnsureChunkConditionsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EntryPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EntryPlugin.js +1 -1
- package/dist/builtin-plugin/EvalDevToolModulePlugin.d.ts +1 -1
- package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ExternalsPlugin.d.ts +3 -3
- package/dist/builtin-plugin/FileUriPlugin.d.ts +1 -1
- package/dist/builtin-plugin/FlagDependencyExportsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/FlagDependencyUsagePlugin.d.ts +1 -1
- package/dist/builtin-plugin/HtmlRspackPlugin.d.ts +2 -2
- package/dist/builtin-plugin/HtmlRspackPlugin.js +2 -2
- package/dist/builtin-plugin/HttpExternalsRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/IgnorePlugin.d.ts +1 -1
- package/dist/builtin-plugin/InferAsyncModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/JavascriptModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/JsLoaderRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/JsLoaderRspackPlugin.js +1 -1
- package/dist/builtin-plugin/JsonModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/LimitChunkCountPlugin.d.ts +1 -1
- package/dist/builtin-plugin/MangleExportsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/MergeDuplicateChunksPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ModuleChunkFormatPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ModuleConcatenationPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NamedChunkIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NamedModuleIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NodeTargetPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ProgressPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ProvidePlugin.d.ts +1 -1
- package/dist/builtin-plugin/RealContentHashPlugin.d.ts +1 -1
- package/dist/builtin-plugin/RemoveEmptyChunksPlugin.d.ts +1 -1
- package/dist/builtin-plugin/RuntimeChunkPlugin.d.ts +1 -1
- package/dist/builtin-plugin/RuntimePlugin.d.ts +1 -1
- package/dist/builtin-plugin/SideEffectsFlagPlugin.d.ts +1 -1
- package/dist/builtin-plugin/SizeLimitsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/SourceMapDevToolPlugin.d.ts +1 -1
- package/dist/builtin-plugin/SplitChunksPlugin.d.ts +2 -2
- package/dist/builtin-plugin/SplitChunksPlugin.js +4 -4
- package/dist/builtin-plugin/SwcCssMinimizerPlugin.d.ts +1 -1
- package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +1 -1
- package/dist/builtin-plugin/WarnCaseSensitiveModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/WebWorkerTemplatePlugin.d.ts +1 -1
- package/dist/builtin-plugin/WorkerPlugin.d.ts +2 -2
- package/dist/builtin-plugin/base.d.ts +1 -1
- package/dist/builtin-plugin/css-extract/index.d.ts +5 -4
- package/dist/builtin-plugin/css-extract/loader.d.ts +1 -1
- package/dist/builtin-plugin/css-extract/loader.js +2 -2
- package/dist/builtin-plugin/index.d.ts +43 -43
- package/dist/builtin-plugin/index.js +43 -43
- package/dist/config/adapter.d.ts +2 -2
- package/dist/config/adapterRuleUse.d.ts +2 -1
- package/dist/config/adapterRuleUse.js +2 -2
- package/dist/config/defaults.js +3 -3
- package/dist/config/index.d.ts +2 -2
- package/dist/config/index.js +2 -2
- package/dist/config/normalization.d.ts +1 -1
- package/dist/config/zod.d.ts +169 -176
- package/dist/config/zod.js +2 -15
- package/dist/container/ContainerPlugin.d.ts +1 -1
- package/dist/container/ContainerReferencePlugin.d.ts +1 -1
- package/dist/container/ContainerReferencePlugin.js +1 -1
- package/dist/container/ModuleFederationPlugin.js +1 -1
- package/dist/container/ModuleFederationPluginV1.d.ts +1 -1
- package/dist/container/ModuleFederationPluginV1.js +1 -1
- package/dist/container/ModuleFederationRuntimePlugin.d.ts +1 -1
- package/dist/exports.d.ts +34 -30
- package/dist/exports.js +21 -18
- package/dist/fileSystem.d.ts +12 -8
- package/dist/fileSystem.js +25 -48
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/lite-tapable/index.d.ts +6 -0
- package/dist/lite-tapable/index.js +107 -1
- package/dist/loader-runner/index.js +13 -13
- package/dist/logging/Logger.d.ts +1 -1
- package/dist/logging/createConsoleLogger.js +0 -14
- package/dist/node/NodeEnvironmentPlugin.d.ts +1 -1
- package/dist/node/NodeEnvironmentPlugin.js +1 -1
- package/dist/node/nodeConsole.js +0 -4
- package/dist/rspack.d.ts +4 -13
- package/dist/rspack.js +8 -8
- package/dist/rspackOptionsApply.d.ts +1 -10
- package/dist/rspackOptionsApply.js +14 -5
- package/dist/sharing/ConsumeSharedPlugin.d.ts +1 -1
- package/dist/sharing/ConsumeSharedPlugin.js +1 -1
- package/dist/stats/DefaultStatsFactoryPlugin.js +2 -2
- package/dist/stats/StatsFactory.d.ts +2 -2
- package/dist/stats/StatsFactory.js +0 -9
- package/dist/stats/StatsPrinter.d.ts +1 -1
- package/dist/stats/statsFactoryUtils.d.ts +1 -1
- package/dist/util/comparators.d.ts +1 -1
- package/dist/util/fs.d.ts +64 -0
- package/dist/util/fs.js +122 -0
- package/dist/util/index.d.ts +2 -1
- package/dist/util/index.js +16 -11
- package/dist/util/source.d.ts +18 -0
- package/dist/util/source.js +66 -0
- package/package.json +4 -4
- package/dist/util/createSource.d.ts +0 -5
- package/dist/util/createSource.js +0 -65
package/dist/util/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deprecatedWarn = exports.toJsAssetInfo = exports.asArray = exports.stringifyLoaderObject = exports.indent = exports.concatErrorMsgAndStack = exports.isJsStatsError = exports.isPromiseLike = exports.serializeObject = exports.toObject = exports.toBuffer = exports.isNil = exports.mapValues = void 0;
|
|
3
|
+
exports.unsupported = exports.deprecatedWarn = exports.toJsAssetInfo = exports.asArray = exports.stringifyLoaderObject = exports.indent = exports.concatErrorMsgAndStack = exports.isJsStatsError = exports.isPromiseLike = exports.serializeObject = exports.toObject = exports.toBuffer = exports.isNil = exports.mapValues = void 0;
|
|
4
4
|
function mapValues(record, fn) {
|
|
5
5
|
return Object.fromEntries(Object.entries(record).map(([key, value]) => [key, fn(value)]));
|
|
6
6
|
}
|
|
@@ -60,16 +60,13 @@ function isJsStatsError(err) {
|
|
|
60
60
|
}
|
|
61
61
|
exports.isJsStatsError = isJsStatsError;
|
|
62
62
|
function concatErrorMsgAndStack(err) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
? `${err.stack}`
|
|
71
|
-
: `${err.message}\n${err.stack}`
|
|
72
|
-
: `${err.message}`;
|
|
63
|
+
if (typeof err === "string") {
|
|
64
|
+
return err;
|
|
65
|
+
}
|
|
66
|
+
if ("stack" in err) {
|
|
67
|
+
return err.stack || err.message;
|
|
68
|
+
}
|
|
69
|
+
return err.message;
|
|
73
70
|
}
|
|
74
71
|
exports.concatErrorMsgAndStack = concatErrorMsgAndStack;
|
|
75
72
|
function indent(str, prefix) {
|
|
@@ -116,3 +113,11 @@ const deprecatedWarn = (content, enable = getDeprecationStatus()) => {
|
|
|
116
113
|
}
|
|
117
114
|
};
|
|
118
115
|
exports.deprecatedWarn = deprecatedWarn;
|
|
116
|
+
const unsupported = (name, issue) => {
|
|
117
|
+
let s = `${name} is not supported by rspack.`;
|
|
118
|
+
if (issue) {
|
|
119
|
+
s += ` Please refer to issue ${issue} for more information.`;
|
|
120
|
+
}
|
|
121
|
+
throw new Error(s);
|
|
122
|
+
};
|
|
123
|
+
exports.unsupported = unsupported;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type { JsCompatSource } from "@rspack/binding";
|
|
3
|
+
import { Source } from "webpack-sources";
|
|
4
|
+
declare class JsSource extends Source {
|
|
5
|
+
static __from_binding(source: JsCompatSource): Source;
|
|
6
|
+
static __to_binding(source: Source): {
|
|
7
|
+
source: Buffer;
|
|
8
|
+
isRaw: boolean;
|
|
9
|
+
isBuffer: boolean;
|
|
10
|
+
map?: undefined;
|
|
11
|
+
} | {
|
|
12
|
+
source: Buffer;
|
|
13
|
+
map: Buffer;
|
|
14
|
+
isRaw: boolean;
|
|
15
|
+
isBuffer: boolean;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export { JsSource };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JsSource = void 0;
|
|
4
|
+
const webpack_sources_1 = require("webpack-sources");
|
|
5
|
+
const index_1 = require("./index");
|
|
6
|
+
class JsSource extends webpack_sources_1.Source {
|
|
7
|
+
static __from_binding(source) {
|
|
8
|
+
if (source.isRaw) {
|
|
9
|
+
return new webpack_sources_1.RawSource(
|
|
10
|
+
// @ts-expect-error: webpack-sources can accept buffer as source, see: https://github.com/webpack/webpack-sources/blob/9f98066311d53a153fdc7c633422a1d086528027/lib/RawSource.js#L12
|
|
11
|
+
source.isBuffer ? source.source : source.source.toString("utf-8"));
|
|
12
|
+
}
|
|
13
|
+
if (!source.map) {
|
|
14
|
+
return new webpack_sources_1.RawSource(source.source.toString("utf-8"));
|
|
15
|
+
}
|
|
16
|
+
return new webpack_sources_1.CompatSource({
|
|
17
|
+
source() {
|
|
18
|
+
return source.source.toString("utf-8");
|
|
19
|
+
},
|
|
20
|
+
buffer() {
|
|
21
|
+
return source.source;
|
|
22
|
+
},
|
|
23
|
+
map(_) {
|
|
24
|
+
if (source.map) {
|
|
25
|
+
return JSON.parse(source.map.toString("utf-8"));
|
|
26
|
+
}
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
static __to_binding(source) {
|
|
32
|
+
var _a, _b, _c;
|
|
33
|
+
const sourceSource = source.source();
|
|
34
|
+
const isBuffer = Buffer.isBuffer(sourceSource);
|
|
35
|
+
if (source instanceof webpack_sources_1.RawSource) {
|
|
36
|
+
return {
|
|
37
|
+
source: source.buffer(),
|
|
38
|
+
isRaw: true,
|
|
39
|
+
isBuffer
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
const buffer = (_b = (_a = source.buffer) === null || _a === void 0 ? void 0 : _a.call(source)) !== null && _b !== void 0 ? _b : (isBuffer
|
|
43
|
+
? sourceSource
|
|
44
|
+
: sourceSource instanceof ArrayBuffer
|
|
45
|
+
? arrayBufferToBuffer(sourceSource)
|
|
46
|
+
: Buffer.from(sourceSource));
|
|
47
|
+
const map = JSON.stringify((_c = source.map) === null || _c === void 0 ? void 0 : _c.call(source, {
|
|
48
|
+
columns: true
|
|
49
|
+
}));
|
|
50
|
+
return {
|
|
51
|
+
source: buffer,
|
|
52
|
+
map: (0, index_1.isNil)(map) ? map : Buffer.from(map),
|
|
53
|
+
isRaw: false,
|
|
54
|
+
isBuffer
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.JsSource = JsSource;
|
|
59
|
+
function arrayBufferToBuffer(ab) {
|
|
60
|
+
const buf = Buffer.alloc(ab.byteLength);
|
|
61
|
+
const view = new Uint8Array(ab);
|
|
62
|
+
for (let i = 0; i < buf.length; ++i) {
|
|
63
|
+
buf[i] = view[i];
|
|
64
|
+
}
|
|
65
|
+
return buf;
|
|
66
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack/core",
|
|
3
|
-
"version": "0.6.5-canary-
|
|
3
|
+
"version": "0.6.5-canary-231c64e-20240515075232",
|
|
4
4
|
"webpackVersion": "5.75.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "A Fast Rust-based Web Bundler",
|
|
@@ -71,8 +71,8 @@
|
|
|
71
71
|
"watchpack": "^2.4.0",
|
|
72
72
|
"zod": "^3.21.4",
|
|
73
73
|
"zod-validation-error": "1.3.1",
|
|
74
|
-
"@rspack/
|
|
75
|
-
"@rspack/
|
|
74
|
+
"@rspack/plugin-minify": "^0.6.5-canary-231c64e-20240515075232",
|
|
75
|
+
"@rspack/core": "0.6.5-canary-231c64e-20240515075232"
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|
|
78
78
|
"@module-federation/runtime-tools": "0.1.6",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"enhanced-resolve": "5.12.0",
|
|
81
81
|
"tapable": "2.2.1",
|
|
82
82
|
"webpack-sources": "3.2.3",
|
|
83
|
-
"@rspack/binding": "0.6.5-canary-
|
|
83
|
+
"@rspack/binding": "0.6.5-canary-231c64e-20240515075232"
|
|
84
84
|
},
|
|
85
85
|
"peerDependencies": {
|
|
86
86
|
"@swc/helpers": ">=0.5.1"
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { JsCompatSource } from "@rspack/binding";
|
|
2
|
-
import { Source } from "webpack-sources";
|
|
3
|
-
declare function createSourceFromRaw(source: JsCompatSource): Source;
|
|
4
|
-
declare function createRawFromSource(source: Source): JsCompatSource;
|
|
5
|
-
export { createSourceFromRaw, createRawFromSource };
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createRawFromSource = exports.createSourceFromRaw = void 0;
|
|
4
|
-
const webpack_sources_1 = require("webpack-sources");
|
|
5
|
-
const index_1 = require("./index");
|
|
6
|
-
function createSourceFromRaw(source) {
|
|
7
|
-
if (source.isRaw) {
|
|
8
|
-
return new webpack_sources_1.RawSource(
|
|
9
|
-
// @ts-expect-error: webpack-sources can accept buffer as source, see: https://github.com/webpack/webpack-sources/blob/9f98066311d53a153fdc7c633422a1d086528027/lib/RawSource.js#L12
|
|
10
|
-
source.isBuffer ? source.source : source.source.toString("utf-8"));
|
|
11
|
-
}
|
|
12
|
-
if (!source.map) {
|
|
13
|
-
return new webpack_sources_1.RawSource(source.source.toString("utf-8"));
|
|
14
|
-
}
|
|
15
|
-
return new webpack_sources_1.CompatSource({
|
|
16
|
-
source() {
|
|
17
|
-
return source.source.toString("utf-8");
|
|
18
|
-
},
|
|
19
|
-
buffer() {
|
|
20
|
-
return source.source;
|
|
21
|
-
},
|
|
22
|
-
map(_) {
|
|
23
|
-
if (source.map) {
|
|
24
|
-
return JSON.parse(source.map.toString("utf-8"));
|
|
25
|
-
}
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
exports.createSourceFromRaw = createSourceFromRaw;
|
|
31
|
-
function createRawFromSource(source) {
|
|
32
|
-
var _a, _b, _c;
|
|
33
|
-
const sourceSource = source.source();
|
|
34
|
-
const isBuffer = Buffer.isBuffer(sourceSource);
|
|
35
|
-
if (source instanceof webpack_sources_1.RawSource) {
|
|
36
|
-
return {
|
|
37
|
-
source: source.buffer(),
|
|
38
|
-
isRaw: true,
|
|
39
|
-
isBuffer
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
const buffer = (_b = (_a = source.buffer) === null || _a === void 0 ? void 0 : _a.call(source)) !== null && _b !== void 0 ? _b : (isBuffer
|
|
43
|
-
? sourceSource
|
|
44
|
-
: sourceSource instanceof ArrayBuffer
|
|
45
|
-
? arrayBufferToBuffer(sourceSource)
|
|
46
|
-
: Buffer.from(sourceSource));
|
|
47
|
-
const map = JSON.stringify((_c = source.map) === null || _c === void 0 ? void 0 : _c.call(source, {
|
|
48
|
-
columns: true
|
|
49
|
-
}));
|
|
50
|
-
return {
|
|
51
|
-
source: buffer,
|
|
52
|
-
map: (0, index_1.isNil)(map) ? map : Buffer.from(map),
|
|
53
|
-
isRaw: false,
|
|
54
|
-
isBuffer
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
exports.createRawFromSource = createRawFromSource;
|
|
58
|
-
function arrayBufferToBuffer(ab) {
|
|
59
|
-
const buf = Buffer.alloc(ab.byteLength);
|
|
60
|
-
const view = new Uint8Array(ab);
|
|
61
|
-
for (let i = 0; i < buf.length; ++i) {
|
|
62
|
-
buf[i] = view[i];
|
|
63
|
-
}
|
|
64
|
-
return buf;
|
|
65
|
-
}
|